RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v11]
Per Minborg
pminborg at openjdk.org
Tue Aug 5 14:17:08 UTC 2025
On Tue, 5 Aug 2025 14:04:26 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR builds on a concept John Rose told me about some time ago. Instead of combining memory operations of various sizes, a single large and skewed memory operation can be made to clean up the tail of remaining bytes.
>>
>> This has the effect of simplifying and shortening the code. The number of branches to evaluate is reduced.
>>
>> It should be noted that the performance of the fill operation affects the allocation of new segments (as they are zeroed out before being returned to the client code).
>>
>> This PR passes tier1, tier2, and tier3 on multiple platforms.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>
> Improve performance
The new performance improvements gave some 8% better performance for smaller segments.
Before improvements
Benchmark (ELEM_SIZE) Mode Cnt Score Error Units
SegmentBulkFill.nativeSegmentFillJava 2 avgt 30 1.322 ± 0.020 ns/op
SegmentBulkFill.nativeSegmentFillJava 3 avgt 30 1.313 ± 0.009 ns/op
SegmentBulkFill.nativeSegmentFillJava 4 avgt 30 1.323 ± 0.023 ns/op
SegmentBulkFill.nativeSegmentFillJava 5 avgt 30 1.309 ± 0.006 ns/op
SegmentBulkFill.nativeSegmentFillJava 6 avgt 30 1.310 ± 0.017 ns/op
SegmentBulkFill.nativeSegmentFillJava 7 avgt 30 1.308 ± 0.004 ns/op
SegmentBulkFill.nativeSegmentFillJava 8 avgt 30 1.312 ± 0.008 ns/op
SegmentBulkFill.nativeSegmentFillJava 12 avgt 30 1.316 ± 0.025 ns/op
After improvements
Benchmark (ELEM_SIZE) Mode Cnt Score Error Units
SegmentBulkFill.nativeSegmentFillJava 2 avgt 30 1.230 ± 0.034 ns/op
SegmentBulkFill.nativeSegmentFillJava 3 avgt 30 1.228 ± 0.037 ns/op
SegmentBulkFill.nativeSegmentFillJava 4 avgt 30 1.243 ± 0.034 ns/op
SegmentBulkFill.nativeSegmentFillJava 5 avgt 30 1.230 ± 0.026 ns/op
SegmentBulkFill.nativeSegmentFillJava 6 avgt 30 1.224 ± 0.025 ns/op
SegmentBulkFill.nativeSegmentFillJava 7 avgt 30 1.232 ± 0.039 ns/op
SegmentBulkFill.nativeSegmentFillJava 8 avgt 30 1.208 ± 0.009 ns/op
SegmentBulkFill.nativeSegmentFillJava 12 avgt 30 1.242 ± 0.030 ns/op
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25383#issuecomment-3155415358
More information about the core-libs-dev
mailing list