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

Minor performance improvements [DATAJPA-1333] #1656

Closed
spring-projects-issues opened this issue Apr 23, 2018 · 1 comment
Closed

Minor performance improvements [DATAJPA-1333] #1656

spring-projects-issues opened this issue Apr 23, 2018 · 1 comment
Assignees
Labels
in: core Issues in core support type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Apr 23, 2018

Сергей Цыпанов opened DATAJPA-1333 and commented

SimpleJpaRepository::executeCountQuery:

  • return type should be long instead of Long as all usages accept primitive
  • total should be long instead of Long to prevent boxing inside of the loop (line 738)

AbstractJpaQuery::containsValue:

Arrays.stream(tuple.toArray()).anyMatch(v -> v.equals(value))

simplifiable to

Arrays.asList(tuple.toArray()).contains(value)

ParameterMetadataProvider.next

Assert.isTrue(parameters.hasNext(), String.format("No parameter available for part %s.", part));

at each call produces new message which is only needed in case of exception, so we can use Supplier instead of explicit String allocation.

Querydsl::addOrderByFrom
According to https://shipilev.net/blog/2016/arrays-wisdom-ancients/ passing empty array into Collection::toArray is faster and contractually cleaner.

Misc:

  • Arrays::asList with one argument -> Collections.singletonList
  • HashSet -> EnumSet where possible
  • correctly sized collections

Affects: 2.0.6 (Kay SR6)

Referenced from: pull request #269

Backported to: 2.0.10 (Kay SR10), 1.11.15 (Ingalls SR15)

@spring-projects-issues
Copy link
Author

spring-projects-issues commented May 23, 2018

Jens Schauder commented

I left a comment on Github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants