Skip to content

Conversation

@SergeiPavlov
Copy link
Contributor

@SergeiPavlov SergeiPavlov commented May 4, 2022

I see EnsureNotLocked() is a hotspot during profiling.
All invocations of EnsureNotLocked() are for this. We can convert it from extension to method.
This adds following optimizations:

  • No need for null check because C# guarantees this is non-null (it can be avoided by manual IL code generating).
  • Access to IsLocked propery via interface is much slower than access to it as a field.

Also:

  • Fix documentation description of ILockable.Lock() - the only its implementation calls Lock(recursive: true). It is recursive by default.
  • Remove Unlock() method as non-usecd

SergeiPavlov and others added 4 commits July 11, 2022 19:32
Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
@alex-kulakov alex-kulakov merged commit dc03d92 into DataObjects-NET:master Jul 12, 2022
@SergeiPavlov SergeiPavlov deleted the upstream/EnsureNotLocked2 branch July 14, 2022 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants