Repository navigation
feat(dotnet): add .NET WASM evaluator package - #107
Merged
Merged
Conversation
Implements .NET wrapper for the flagd-evaluator WASM module using Wasmtime .NET v34.0.2 with the same architecture as the Go/Java packages: - WASM instance pool (BlockingCollection, sized to ProcessorCount) - Lock-free pre-evaluated cache via volatile reference swap - Context key filtering (only serialize keys used in targeting rules) - Index-based evaluation (evaluate_by_index avoids flag key serialization) - Generation guard for safe race handling between UpdateState and EvaluateFlag - Pre-allocated buffers (256B flag key + 1MB context per instance) - Prefix-based host function matching (survives wasm-bindgen hash changes) - 17 xunit tests including concurrency and generation guard - BenchmarkDotNet suite with evaluation and concurrency benchmarks Closes #105 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add MinimalInProcessResolver wrapping json-everything's JsonLogic (v5.4.0), the same library used by the production flagd .NET provider. Comparison benchmarks (X1-X5) mirror the Java/Go pattern: simple flags, targeting, context size sweep, and concurrent evaluation. Key results: WASM evaluator is 1.4x faster for targeting, 6.2x faster with large contexts (100+ attrs), and allocates 56x less memory — context key filtering avoids serializing unused attributes. Closes #105 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dotnet/) wrapping the Rust WASM evaluator using Wasmtime for .NET v34.0.2Architecture
BlockingCollection<WasmInstance>sized toProcessorCountfor parallel evaluationvolatilereference swap (13 ns, zero alloc)evaluate_by_index(u32)avoids flag key string serializationComparison: WASM vs Old JsonLogic Provider (json-everything v5.4.0)
Context key filtering gives the biggest win: with 100+ attributes, the old provider serializes everything (33 KB allocations), while the WASM evaluator only serializes the 2 keys referenced in targeting rules (592 B).
Standalone Evaluation Benchmarks
Test plan
make wasm && make build && make testfrom clean checkoutCloses #105
🤖 Generated with Claude Code