[CSHARP-4028] Performance: Too many lambda closure allocations in JsonWriter.EscapedString Created: 31/Jan/22  Updated: 28/Oct/23  Resolved: 02/Feb/22

Status: Closed
Project: C# Driver
Component/s: Json, Performance
Affects Version/s: 2.14.0
Fix Version/s: 2.15.0

Type: Improvement Priority: Major - P3
Reporter: Daniel Hegener Assignee: Robert Stam
Resolution: Fixed Votes: 0
Labels: Performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2022-01-31-22-51-48-450.png     PNG File image-2022-01-31-22-52-21-374.png     PNG File image-2022-01-31-22-55-01-398.png    
Quarter: FY22Q1
Backwards Compatibility: Fully Compatible

 Description   

Some lambda closure related allocation topic has popped up in my most recent perf. profiling:

The fix for this appears to be a complete no-brainer: Make the NeedsEscaping method static. I will create a PR for this. There's additional algorithmic improvement opportunities here but I am not sure they're worth looking into at this stage. Will keep on profiling.



 Comments   
Comment by Githook User [ 02/Feb/22 ]

Author:

{'name': 'Daniel Hegener', 'email': 'daniel.hegener@fisglobal.com'}

Message: CSHARP-4028: Reduced allocations by eliminating a lambda closure
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/0ce5205228195ad07580e3552b45a9c8d561c05a

Comment by Robert Stam [ 01/Feb/22 ]

Thank you for creating this ticket and for submitting a PR for it. We will review it soon.

Comment by Daniel Hegener [ 31/Jan/22 ]

https://github.com/mongodb/mongo-csharp-driver/pull/726

Generated at Wed Feb 07 21:46:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.