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

Storing JdbcSession argument in CopyOnWriteArrayList is suboptimal #80

Closed
golszewski86 opened this issue Feb 11, 2020 · 6 comments
Closed

Comments

@golszewski86
Copy link
Contributor

JdbcSession stores all the arguments in CopyOnWriteArrayList which implies copying the whole list every time an argument is added. In most cases it doesn't make any difference compared to mutable list like ArrayList or LinkedList, but when you have to add thousands of arguments it causes a significant overhead.

According to javadoc the CopyOnWriteArrayList "is ordinarily too costly, but may be more efficient than alternatives when traversal operations vastly outnumber mutations, and is useful when you cannot or don't want to synchronize traversals, yet need to preclude interference among concurrent threads".

Obviously in case of JdbcSession traversal operations don't outnumber mutations and accessing this (mutable) object from multiple threads doesn't make any sense.

Can we get rid of CopyOnWriteArrayList in the sake of performance when it comes to really huge arguments' lists?

@0crat
Copy link

0crat commented Feb 11, 2020

@yegor256/z please, pay attention to this issue

@0crat
Copy link

0crat commented Feb 11, 2020

@golszewski86/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!

yegor256 added a commit that referenced this issue Jun 10, 2023
yegor256 added a commit that referenced this issue Jun 10, 2023
yegor256 added a commit that referenced this issue Jun 10, 2023
@yegor256
Copy link
Member

@rultor release, tag is 0.18.2

@rultor
Copy link
Contributor

rultor commented Jun 10, 2023

@rultor release, tag is 0.18.2

@yegor256 OK, I will release it now. Please check the progress here

@rultor
Copy link
Contributor

rultor commented Jun 10, 2023

@rultor release, tag is 0.18.2

@yegor256 Done! FYI, the full log is here (took me 19min)

@yegor256
Copy link
Member

@golszewski86 it's fixed in 0.18.2, per your suggestion

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

No branches or pull requests

4 participants