-
Notifications
You must be signed in to change notification settings - Fork 30
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
Comments
@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! |
@rultor release, tag is |
@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
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?
The text was updated successfully, but these errors were encountered: