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

Reduce object creation in Rounding class #38061

Merged

Conversation

spinscale
Copy link
Contributor

While benchmarking the rounding code due to slower date histogram
aggregations I noticed a few useless object creations due to the
builder/fluent java time API. This reduces creations by properly
creating the objects. Furthermore a few unneeded ZonedDateTime objects
were created in order to create other objects out of them. This was
changed as well.

Running the benchmarks shows a much faster performance for all of the
java time based Rounding classes, which means this was not yet the aggs
date histogram culprit.

While benchmarking the rounding code due to slower date histogram
aggregations I noticed a lot of useless object creations due to the
builder/fluent java time API. This reduces creations by properly
creating the objects. Furthermore a few unneeded ZonedDateTime objects
were created in order to create other objects out of them. This was
changed as well.

Running the benchmarks shows a much faster performance for all of the
java time based Rounding classes, which means this was not yet the aggs
culprit.
@spinscale spinscale added >non-issue :Core/Infra/Core Core issues without another label v7.0.0 labels Jan 30, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

LGTM. Can you please also post the benchmark results here on the PR for future reference?

@spinscale
Copy link
Contributor Author

benchmark results

Benchmark                                                 Mode  Cnt    Score    Error  Units
RoundingBenchmark.timeIntervalRoundingJava                avgt   30  221,675 ±  1,281  ns/op
RoundingBenchmark.timeIntervalRoundingJoda                avgt   30  377,375 ± 28,692  ns/op
RoundingBenchmark.timeRoundingDateTimeUnitDayOfMonthJava  avgt   30  227,625 ±  5,541  ns/op
RoundingBenchmark.timeRoundingDateTimeUnitDayOfMonthJoda  avgt   30  404,853 ±  3,583  ns/op
RoundingBenchmark.timeRoundingDateTimeUnitJava            avgt   30  134,625 ±  0,859  ns/op
RoundingBenchmark.timeRoundingDateTimeUnitJoda            avgt   30  362,587 ± 23,980  ns/op

@spinscale spinscale merged commit 9f026bb into elastic:master Jan 31, 2019
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jan 31, 2019
* master: (100 commits)
  Push primary term to replication tracker (elastic#38044)
  Introduce ability to minimize round-trips in CCS (elastic#37828)
  Don't Assert Ack on when Publish Timeout is 0 in Test (elastic#38077)
  Reduce object creation in Rounding class (elastic#38061)
  Treat put-mapping calls with `_doc` as a top-level key as typed calls. (elastic#38032)
  Fix test bug when testing the merging of mappings and templates. (elastic#38021)
  spelling: java script -- not JavaScript (elastic#37057)
  Enable SSL in reindex with security QA tests (elastic#37600)
  Disable BWC tests during backport (elastic#38074)
  SQL: Added SSL configuration options tests (elastic#37875)
  Minor fixes in the release notes script. (elastic#37967)
  Fix typo in docs. (elastic#38018)
  Update Lucene repo for 7.0.0-alpha2 (elastic#37985)
  Fix size of rolling-upgrade bootstrap config (elastic#38031)
  fix DateIndexNameProcessorTests offset pattern (elastic#38069)
  Speed up converting of temporal accessor to zoned date time (elastic#37915)
  Work around JDK8 timezone bug in tests (elastic#37968)
  Correct arg names when update mapping/settings from leader (elastic#38063)
  Introduce ssl settings to reindex from remote (elastic#37527)
  Mute testRetentionLeasesSyncOnExpiration
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >non-issue v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants