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

Use ConcurrentMap instead of synchronized for class cache #330

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

jungnitz
Copy link
Contributor

@jungnitz jungnitz commented Oct 1, 2024

I am currently developing an application that generates lots of documents in parallel. While profiling I noticed a bottleneck in OdfXMLFactory#getOdfNodeClass.

Since almost all entries of the Class cache are known after reading some documents, it should be possible to reduce locking and therefore increase parallelism. I firstly tried replacing the synchronized-Blocks with a RW-Lock, which resulted in slightly slower execution times. Using a ConcurrentHashMap however almost doubled the document throughput in my application.

Therefore I propose the changes in the commit.

Copy link
Contributor

@svanteschubert svanteschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thank you very much, Niklas, for your contribution! Very much appreciated!
With kind regards from Berlin, Svante

@svanteschubert svanteschubert merged commit c4c11a6 into tdf:master Oct 1, 2024
2 checks passed
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