RFR: 7944: Reduce allocations of Double during chunk loading

Richard Startin duke at openjdk.org
Tue Oct 25 09:25:37 UTC 2022


Using jmc-common as a library in a backend process we see high allocation rates of `Double` and have observed moderate performance improvements from this simple refactoring:
* Use primitive `double` in `ImpreciseScaleFactor`
* Use primitive `double` in `IScalarAffineTransformation.getOffset`
* Push multiplication of a scale factor down to a new method `ScaleFactor.scale(long multiplier)`
* Push `ScalarQuantity.in` down to `LongStored`/`DoubleStored` to avoid generalising over primitive types, when the `IQuantity` type can be varied instead.
---------
### Progress
- [ ] Commit message must refer to an issue
- [ ] Change must be properly reviewed (1 review required, with at least 1 [Committer](https://openjdk.org/bylaws#committer))

### Reviewing
<details><summary>Using <code>git</code></summary>

Checkout this PR locally: \
`$ git fetch https://git.openjdk.org/jmc pull/436/head:pull/436` \
`$ git checkout pull/436`

Update a local copy of the PR: \
`$ git checkout pull/436` \
`$ git pull https://git.openjdk.org/jmc pull/436/head`

</details>
<details><summary>Using Skara CLI tools</summary>

Checkout this PR locally: \
`$ git pr checkout 436`

View PR using the GUI difftool: \
`$ git pr show -t 436`

</details>
<details><summary>Using diff file</summary>

Download this PR as a diff file: \
<a href="https://git.openjdk.org/jmc/pull/436.diff">https://git.openjdk.org/jmc/pull/436.diff</a>

</details>

-------------

Commit messages:
 - JMC-7944: Reduce allocations of Double during chunk loading

Changes: https://git.openjdk.org/jmc/pull/436/files
 Webrev: https://webrevs.openjdk.org/?repo=jmc&pr=436&range=00
  Issue: https://bugs.openjdk.org/browse/JMC-7944
  Stats: 103 lines in 10 files changed: 47 ins; 28 del; 28 mod
  Patch: https://git.openjdk.org/jmc/pull/436.diff
  Fetch: git fetch https://git.openjdk.org/jmc pull/436/head:pull/436

PR: https://git.openjdk.org/jmc/pull/436


More information about the jmc-dev mailing list