Skip to content

Use ArrayList instead of LinkedList for known size #1643

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

Merged
merged 1 commit into from
Jan 14, 2018

Conversation

marschall
Copy link
Contributor

Spring JDBC unlike other modules uses LinkedList instead of ArrayList
in several places. There is a large body of evidence suggesting that on
contemporary hardware ArrayList is both faster and has less overhead
than even in degenerate cases of empty lists [3] or unknown size.

There are two places in Spring JDBC where the size of the list is known
in advance and an ArrayList of the correct final size can be created

[1] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8011200
[2] http://cliffc.org/blog/2017/11/05/modern-hardware-performance-cache-lines/
[3] https://bugs.openjdk.java.net/browse/JDK-8011200

Issue: SPR-16378

Spring JDBC unlike other modules uses LinkedList instead of ArrayList
in several places. There is a large body of evidence suggesting that on
contemporary hardware ArrayList is both faster and has less overhead
than even in degenerate cases of empty lists [3] or unknown size.

There are two places in Spring JDBC where the size of the list is known
in advance and an ArrayList of the correct final size can be created

 [1] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8011200
 [2] http://cliffc.org/blog/2017/11/05/modern-hardware-performance-cache-lines/
 [3] https://bugs.openjdk.java.net/browse/JDK-8011200

Issue: SPR-16378
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