Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Performance of Debug Native Object tracking #433

Closed
alexw91 opened this issue Jan 25, 2022 · 1 comment
Closed

Improve Performance of Debug Native Object tracking #433

alexw91 opened this issue Jan 25, 2022 · 1 comment
Labels
feature-request A feature should be added or improved. needs-discussion This issue/PR requires more discussion with community. p3 This is a minor priority issue

Comments

@alexw91
Copy link
Member

alexw91 commented Jan 25, 2022

In a previous Pull Request a change was made to replace the backing native resource object map in debug mode from a ConcurrentHashMap to a HashMap that used the synchronized keyword on the class name around all accesses.

While this implementation is also correct, it has slower performance than continuing to use ConcurrentHashMap when in debug mode. Synchronization will lock the entire HashMap any time any thread is adding or removing any time from the Map, and will cause contention issues if multiple threads are making reads/writes simultaneously. Whereas ConcurrentHashMap only locks a small inner subset of the backing Map during reads/writes, and makes it much less likely that two threads will create contention issues if both are making modifications simultaneously.

For more info on this, see:

@bretambrose
Copy link
Contributor

bretambrose commented Jan 26, 2022

This is debug-trace-only code and having a consistent snapshot of state is the most important consideration.

@yasminetalby yasminetalby added the p3 This is a minor priority issue label Jun 26, 2023
@yasminetalby yasminetalby added feature-request A feature should be added or improved. needs-discussion This issue/PR requires more discussion with community. labels Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. needs-discussion This issue/PR requires more discussion with community. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

3 participants