Skip to content

Conversation

@wendigo
Copy link
Contributor

@wendigo wendigo commented Jun 27, 2025

No description provided.

@wendigo wendigo force-pushed the serafin/copy-memory-using-segment-api branch 2 times, most recently from 84f32f2 to 9d72342 Compare June 27, 2025 20:07
Copy link
Member

@electrum electrum left a comment

Choose a reason for hiding this comment

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

I'm curious, did you run any benchmarks? We'll need to get rid of unsafe either way, but it'd be good to know if there is a big regression.

@martint
Copy link
Member

martint commented Jun 30, 2025

JDK 22 is EOL. Why not 24?

@wendigo
Copy link
Contributor Author

wendigo commented Jun 30, 2025

@electrum there is a performance regression

@wendigo wendigo force-pushed the serafin/copy-memory-using-segment-api branch from 9d72342 to d6df543 Compare July 1, 2025 09:26
@wendigo wendigo changed the title Switch to JDK 22 and use MemorySegment.copy instead of Unsafe.copyMemory Switch to JDK 24 and use MemorySegment.copy instead of Unsafe.copyMemory Jul 1, 2025
@wendigo
Copy link
Contributor Author

wendigo commented Jul 1, 2025

jmh-result.json

@wendigo
Copy link
Contributor Author

wendigo commented Jul 1, 2025

Benchmark                 (copyStrategy)     (size)   Mode  Cnt           Score          Error  Units
MemoryCopyBenchmark.copy      ARRAY_COPY          0  thrpt   10   901657389,052 ± 29132149,953  ops/s
MemoryCopyBenchmark.copy      ARRAY_COPY         32  thrpt   10   603885939,000 ± 27836132,529  ops/s
MemoryCopyBenchmark.copy      ARRAY_COPY        128  thrpt   10   279077934,981 ± 11230682,697  ops/s
MemoryCopyBenchmark.copy      ARRAY_COPY        512  thrpt   10   146525888,827 ±   824473,281  ops/s
MemoryCopyBenchmark.copy      ARRAY_COPY       1024  thrpt   10    88049470,182 ±   695551,785  ops/s
MemoryCopyBenchmark.copy      ARRAY_COPY    1048576  thrpt   10       66358,695 ±     1010,009  ops/s
MemoryCopyBenchmark.copy      ARRAY_COPY  134217728  thrpt   10         499,064 ±       10,255  ops/s
MemoryCopyBenchmark.copy           SLICE          0  thrpt   10   937358623,715 ± 21376582,130  ops/s
MemoryCopyBenchmark.copy           SLICE         32  thrpt   10   402867808,980 ±  9333573,030  ops/s
MemoryCopyBenchmark.copy           SLICE        128  thrpt   10   267096094,385 ± 19098537,804  ops/s
MemoryCopyBenchmark.copy           SLICE        512  thrpt   10   139491392,642 ±  2785986,960  ops/s
MemoryCopyBenchmark.copy           SLICE       1024  thrpt   10    89055601,674 ±   631193,010  ops/s
MemoryCopyBenchmark.copy           SLICE    1048576  thrpt   10       73376,188 ±    11678,820  ops/s
MemoryCopyBenchmark.copy           SLICE  134217728  thrpt   10         454,261 ±        6,087  ops/s
MemoryCopyBenchmark.copy     CUSTOM_LOOP          0  thrpt   10  1195460002,864 ± 12370060,410  ops/s
MemoryCopyBenchmark.copy     CUSTOM_LOOP         32  thrpt   10   409240611,269 ±  5002407,499  ops/s
MemoryCopyBenchmark.copy     CUSTOM_LOOP        128  thrpt   10   241598565,856 ±  7046155,417  ops/s
MemoryCopyBenchmark.copy     CUSTOM_LOOP        512  thrpt   10    83449657,344 ±   527316,461  ops/s
MemoryCopyBenchmark.copy     CUSTOM_LOOP       1024  thrpt   10    43169077,504 ±   477728,024  ops/s
MemoryCopyBenchmark.copy     CUSTOM_LOOP    1048576  thrpt   10       39429,141 ±      842,938  ops/s
MemoryCopyBenchmark.copy     CUSTOM_LOOP  134217728  thrpt   10         300,494 ±        7,178  ops/s
MemoryCopyBenchmark.copy          UNSAFE          0  thrpt   10   630977317,683 ±  4019456,494  ops/s
MemoryCopyBenchmark.copy          UNSAFE         32  thrpt   10   314375731,386 ± 13319636,578  ops/s
MemoryCopyBenchmark.copy          UNSAFE        128  thrpt   10   216099890,014 ±  6037883,421  ops/s
MemoryCopyBenchmark.copy          UNSAFE        512  thrpt   10   134828928,063 ±  2995346,434  ops/s
MemoryCopyBenchmark.copy          UNSAFE       1024  thrpt   10    84229060,616 ±   950809,283  ops/s
MemoryCopyBenchmark.copy          UNSAFE    1048576  thrpt   10       61078,617 ±     7460,381  ops/s
MemoryCopyBenchmark.copy          UNSAFE  134217728  thrpt   10         448,991 ±        5,766  ops/s
MemoryCopyBenchmark.copy             FFM          0  thrpt   10   874448960,464 ± 49146688,834  ops/s
MemoryCopyBenchmark.copy             FFM         32  thrpt   10   315989952,147 ± 11682953,273  ops/s
MemoryCopyBenchmark.copy             FFM        128  thrpt   10   246591525,763 ±  7902114,119  ops/s
MemoryCopyBenchmark.copy             FFM        512  thrpt   10   142302475,045 ±  3280815,814  ops/s
MemoryCopyBenchmark.copy             FFM       1024  thrpt   10    88473153,712 ±  1146379,388  ops/s
MemoryCopyBenchmark.copy             FFM    1048576  thrpt   10       64623,106 ±     7890,197  ops/s
MemoryCopyBenchmark.copy             FFM  134217728  thrpt   10         440,010 ±       15,141  ops/s

Benchmark result is saved to jmh-result.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants