Hi,
I was able to set up an example to demonstrate the issue. It seems to be related to the connection type (local or cloud). However, even with a local connection, performance appears to be about 20% slower. When not local, the performance difference is significant, ranging from 20x to 50x slower.
Here’s the repository I used for testing:
GitHub - mongodb-linq-issue
For faster local setup, I used .NET Aspire. You can switch between LINQ versions by commenting/uncommenting these lines in Program.cs:
// settings.LinqProvider = LinqProvider.V3;
settings.LinqProvider = LinqProvider.V2;
Additionally, you can adjust the seed array (bucketIds) in ExampleCollectionSeed.cs to reduce the number of generated documents.
Results
Here are my local test results with the current setup:
LINQ V2:
- Time spent:
00:01:11.4165811 (2800 results)
- Time spent:
00:01:07.4483099 (2800 results)
- Time spent:
00:01:07.4265999 (2800 results)
- Time spent:
00:01:07.2861247 (2800 results)
- Time spent:
00:01:07.1483622 (2800 results)
LINQ V3:
- Time spent:
00:01:25.3082952 (2800 results)
- Time spent:
00:01:23.6927336 (2800 results)
- Time spent:
00:01:22.7419893 (2800 results)
- Time spent:
00:01:24.4259722 (2800 results)
- Time spent:
00:01:23.5046322 (2800 results)
Let me know if additional information or adjustments are needed!