-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Performance Benchmarking
-
None
-
Dotnet Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Motivation
LinqEndToEndBenchmark (added in CSHARP-5992) pairs each LINQ query with a hand-built Raw BsonDocument/pipeline; the LINQ−Raw delta is only meaningful if both render to the same query shape. Today that equivalence is verified manually at design time by translating each LINQ expression through LinqProviderAdapter and diffing against the pre-built Raw doc.
If a future translator change shifts the emitted BSON, the Raw doc silently stops matching. The benchmark keeps running — it just measures a different comparison — so the translator-share numbers drift with no failure and no signal that anything broke.
Proposed change
In [GlobalSetup], after PreBuildQueries(), render each LINQ expression to BSON via the same path the driver uses and assert it equals the corresponding pre-built Raw doc, throwing on divergence so the benchmark fails loudly at setup. Covers the six pairs:
- Find filters — MultiFieldSearch, OrFilter, InFilter (vs _multiFieldFilter / _orFilter / _inFilter)
- Find + projection — Projection (vs _projectionFilter + _projectionDoc)
- Aggregate pipelines — GroupBy, PagedQuery (vs _groupByPipeline / _pagedQueryPipeline)
The rendering call differs by query type (filter vs projection vs pipeline), so it isn't a single shared assertion.
Acceptance criteria
- [GlobalSetup] asserts each of the six LINQ expressions renders to BSON equal to its pre-built Raw doc.
- A deliberate divergence (e.g. altering a Raw doc) fails at setup with a message naming the diverging pair.
- The measured benchmark methods are unchanged.