DuendeSoftware / IdentityServer

The most flexible and standards-compliant OpenID Connect and OAuth 2.x framework for ASP.NET Core
https://duendesoftware.com/products/identityserver
Other
1.49k stars 344 forks source link

Switched to the more performant System.Threading.Lock locks. #1605

Closed MarkCiliaVincenti closed 1 month ago

josephdecock commented 1 month ago

Hi, thanks for the PR. Did you encounter a performance problem in practice that this solves? Have you benchmarked this at all?

MarkCiliaVincenti commented 1 month ago

Hi, thanks for the PR. Did you encounter a performance problem in practice that this solves? Have you benchmarked this at all?

Hi, yes the benchmarks show around a 25% performance improvement between locking on an object and locking on System.Threading.Lock.

https://steven-giesel.com/blogPost/4cf6d48a-ec9d-4c68-961c-31fd8d8c1340

https://github.com/MarkCiliaVincenti/Backport.System.Threading.Lock/tree/master/Backport.System.Threading.Lock.Benchmarks

MarkCiliaVincenti commented 16 hours ago

@josephdecock a new version of Backport.System.Threading.Lock has come out that acts as a source generator and basically dropping the DLL as a dependency. If this new development makes you reconsider, I will amend this PR accordingly.