-
Enhancement
-
Resolution: Unresolved
-
P4
-
24
Maurizio reported:
https://github.com/openjdk/jdk/compare/master...mcimadamore:jdk:manual_mismatch_bench?expand=1
Benchmark (ELEM_SIZE) Mode Cnt Score Error Units
HeapMismatchManualLoopTest.array_mismatch 4 avgt 30 4.127 ± 0.348 ns/op
HeapMismatchManualLoopTest.array_mismatch 8 avgt 30 6.853 ± 0.634 ns/op
HeapMismatchManualLoopTest.array_mismatch 16 avgt 30 8.688 ± 0.293 ns/op
HeapMismatchManualLoopTest.array_mismatch 32 avgt 30 14.533 ± 0.499 ns/op
HeapMismatchManualLoopTest.array_mismatch 64 avgt 30 26.003 ± 0.722 ns/op
HeapMismatchManualLoopTest.array_mismatch 128 avgt 30 48.277 ± 2.705 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 4 avgt 30 9.478 ± 1.031 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 8 avgt 30 11.535 ± 0.456 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 16 avgt 30 15.804 ± 0.242 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 32 avgt 30 22.430 ± 1.295 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 64 avgt 30 35.522 ± 0.127 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 128 avgt 30 72.621 ± 2.236 ns/op
HeapMismatchManualLoopTest.segment_mismatch 4 avgt 30 14.222 ± 2.038 ns/op
HeapMismatchManualLoopTest.segment_mismatch 8 avgt 30 16.062 ± 0.271 ns/op
HeapMismatchManualLoopTest.segment_mismatch 16 avgt 30 19.308 ± 0.106 ns/op
HeapMismatchManualLoopTest.segment_mismatch 32 avgt 30 28.064 ± 1.462 ns/op
HeapMismatchManualLoopTest.segment_mismatch 64 avgt 30 39.238 ± 0.434 ns/op
HeapMismatchManualLoopTest.segment_mismatch 128 avgt 30 55.971 ± 0.339 ns/op
For very small sizes, arrays seems much better, but ByteBuffer is also better than MemorySegment.
As the size increase, the gap gets smaller and then, for bigger sizes, MemorySegments overtakes ByteBuffers and gets quite close to the array variant.
https://github.com/openjdk/jdk/compare/master...mcimadamore:jdk:manual_mismatch_bench?expand=1
Benchmark (ELEM_SIZE) Mode Cnt Score Error Units
HeapMismatchManualLoopTest.array_mismatch 4 avgt 30 4.127 ± 0.348 ns/op
HeapMismatchManualLoopTest.array_mismatch 8 avgt 30 6.853 ± 0.634 ns/op
HeapMismatchManualLoopTest.array_mismatch 16 avgt 30 8.688 ± 0.293 ns/op
HeapMismatchManualLoopTest.array_mismatch 32 avgt 30 14.533 ± 0.499 ns/op
HeapMismatchManualLoopTest.array_mismatch 64 avgt 30 26.003 ± 0.722 ns/op
HeapMismatchManualLoopTest.array_mismatch 128 avgt 30 48.277 ± 2.705 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 4 avgt 30 9.478 ± 1.031 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 8 avgt 30 11.535 ± 0.456 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 16 avgt 30 15.804 ± 0.242 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 32 avgt 30 22.430 ± 1.295 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 64 avgt 30 35.522 ± 0.127 ns/op
HeapMismatchManualLoopTest.buffer_mismatch 128 avgt 30 72.621 ± 2.236 ns/op
HeapMismatchManualLoopTest.segment_mismatch 4 avgt 30 14.222 ± 2.038 ns/op
HeapMismatchManualLoopTest.segment_mismatch 8 avgt 30 16.062 ± 0.271 ns/op
HeapMismatchManualLoopTest.segment_mismatch 16 avgt 30 19.308 ± 0.106 ns/op
HeapMismatchManualLoopTest.segment_mismatch 32 avgt 30 28.064 ± 1.462 ns/op
HeapMismatchManualLoopTest.segment_mismatch 64 avgt 30 39.238 ± 0.434 ns/op
HeapMismatchManualLoopTest.segment_mismatch 128 avgt 30 55.971 ± 0.339 ns/op
For very small sizes, arrays seems much better, but ByteBuffer is also better than MemorySegment.
As the size increase, the gap gets smaller and then, for bigger sizes, MemorySegments overtakes ByteBuffers and gets quite close to the array variant.
- relates to
-
JDK-8344085 C2 SuperWord: improve vectorization for small loop iteration count
- Open
-
JDK-8307084 C2: Vectorized drain loop is not executed for some small trip counts
- In Progress
- links to
-
Review(master) openjdk/jdk/21630