diff --git a/common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java b/common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java index 9d97d04a58137..9bb69ec2471b4 100644 --- a/common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java +++ b/common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java @@ -43,6 +43,10 @@ public final class Platform { public static final int DOUBLE_ARRAY_OFFSET; + // Field offset for java.nio.Buffer.address — used to read the native memory address + // of a DirectByteBuffer without going through sun.nio.ch.DirectBuffer. + private static final long DIRECT_BUFFER_ADDRESS_OFFSET; + private static final boolean unaligned; // Split java.version on non-digit chars: @@ -230,6 +234,14 @@ public static ByteBuffer allocateDirectBuffer(int size) { throw new IllegalStateException("unreachable"); } + /** + * Returns the native memory address of a direct {@link ByteBuffer}. + * The buffer must be direct; passing a heap buffer produces an undefined result. + */ + public static long getDirectBufferAddress(ByteBuffer buffer) { + return _UNSAFE.getLong(buffer, DIRECT_BUFFER_ADDRESS_OFFSET); + } + public static void setMemory(Object object, long offset, long size, byte value) { _UNSAFE.setMemory(object, offset, size, value); } @@ -296,6 +308,12 @@ public static void throwException(Throwable t) { LONG_ARRAY_OFFSET = _UNSAFE.arrayBaseOffset(long[].class); FLOAT_ARRAY_OFFSET = _UNSAFE.arrayBaseOffset(float[].class); DOUBLE_ARRAY_OFFSET = _UNSAFE.arrayBaseOffset(double[].class); + try { + DIRECT_BUFFER_ADDRESS_OFFSET = + _UNSAFE.objectFieldOffset(java.nio.Buffer.class.getDeclaredField("address")); + } catch (NoSuchFieldException e) { + throw new IllegalStateException(e); + } } else { BOOLEAN_ARRAY_OFFSET = 0; BYTE_ARRAY_OFFSET = 0; @@ -304,6 +322,7 @@ public static void throwException(Throwable t) { LONG_ARRAY_OFFSET = 0; FLOAT_ARRAY_OFFSET = 0; DOUBLE_ARRAY_OFFSET = 0; + DIRECT_BUFFER_ADDRESS_OFFSET = 0; } } diff --git a/core/benchmarks/PlatformBenchmark-jdk21-results.txt b/core/benchmarks/PlatformBenchmark-jdk21-results.txt index ffbe880644759..934859387ae18 100644 --- a/core/benchmarks/PlatformBenchmark-jdk21-results.txt +++ b/core/benchmarks/PlatformBenchmark-jdk21-results.txt @@ -2,112 +2,124 @@ Platform Byte Access ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Byte Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putByte: On-heap 65 65 1 1540.3 0.6 1.0X -putByte: Off-heap 76 76 0 1314.8 0.8 0.9X -getByte: On-heap 53 53 0 1885.8 0.5 1.2X -getByte: Off-heap 46 46 0 2170.2 0.5 1.4X +putByte: On-heap 65 65 0 1543.7 0.6 1.0X +putByte: Off-heap 76 76 0 1312.9 0.8 0.9X +getByte: On-heap 53 53 1 1886.1 0.5 1.2X +getByte: Off-heap 43 46 1 2307.0 0.4 1.5X ================================================================================================ Platform Short Access ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Short Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putShort: On-heap 63 63 0 1581.9 0.6 1.0X -putShort: Off-heap 71 71 0 1408.9 0.7 0.9X -getShort: On-heap 43 43 0 2343.8 0.4 1.5X -getShort: Off-heap 50 50 0 1998.5 0.5 1.3X +putShort: On-heap 63 64 0 1579.8 0.6 1.0X +putShort: Off-heap 71 71 0 1404.6 0.7 0.9X +getShort: On-heap 43 43 0 2342.2 0.4 1.5X +getShort: Off-heap 50 50 0 1994.1 0.5 1.3X ================================================================================================ Platform Int Access ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Int Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putInt: On-heap 56 56 0 1781.2 0.6 1.0X -putInt: Off-heap 53 53 0 1892.8 0.5 1.1X -getInt: On-heap 35 35 0 2848.5 0.4 1.6X -getInt: Off-heap 37 38 0 2678.7 0.4 1.5X +putInt: On-heap 56 56 0 1780.9 0.6 1.0X +putInt: Off-heap 52 52 0 1919.4 0.5 1.1X +getInt: On-heap 35 35 0 2869.3 0.3 1.6X +getInt: Off-heap 37 38 0 2676.8 0.4 1.5X ================================================================================================ Platform Long Access ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Long Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putLong: On-heap 69 69 0 1445.7 0.7 1.0X -putLong: Off-heap 52 53 1 1907.6 0.5 1.3X -getLong: On-heap 41 42 1 2434.5 0.4 1.7X -getLong: Off-heap 45 46 1 2242.5 0.4 1.6X +putLong: On-heap 69 69 0 1451.6 0.7 1.0X +putLong: Off-heap 52 52 0 1929.6 0.5 1.3X +getLong: On-heap 41 42 0 2437.7 0.4 1.7X +getLong: Off-heap 44 44 0 2291.5 0.4 1.6X ================================================================================================ Platform Float Access ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Float Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putFloat: On-heap 44 44 0 2274.8 0.4 1.0X -putFloat: Off-heap 48 48 0 2105.0 0.5 0.9X -getFloat: On-heap 94 94 0 1068.3 0.9 0.5X -getFloat: Off-heap 94 94 0 1068.1 0.9 0.5X +putFloat: On-heap 44 44 0 2276.4 0.4 1.0X +putFloat: Off-heap 48 48 0 2091.5 0.5 0.9X +getFloat: On-heap 94 94 0 1067.0 0.9 0.5X +getFloat: Off-heap 94 94 0 1065.9 0.9 0.5X ================================================================================================ Platform Double Access ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Double Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putDouble: On-heap 46 47 0 2154.5 0.5 1.0X -putDouble: Off-heap 50 50 0 2014.0 0.5 0.9X -getDouble: On-heap 94 95 0 1058.6 0.9 0.5X -getDouble: Off-heap 95 95 0 1053.9 0.9 0.5X +putDouble: On-heap 47 47 0 2127.4 0.5 1.0X +putDouble: Off-heap 49 50 0 2025.5 0.5 1.0X +getDouble: On-heap 94 95 0 1058.9 0.9 0.5X +getDouble: Off-heap 95 95 0 1053.3 0.9 0.5X ================================================================================================ Platform Boolean Access ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Boolean Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putBoolean: On-heap 66 66 0 1509.1 0.7 1.0X -putBoolean: Off-heap 78 80 7 1289.7 0.8 0.9X -getBoolean: On-heap 62 62 0 1606.0 0.6 1.1X -getBoolean: Off-heap 62 62 0 1605.6 0.6 1.1X +putBoolean: On-heap 66 67 3 1511.5 0.7 1.0X +putBoolean: Off-heap 78 78 1 1287.1 0.8 0.9X +getBoolean: On-heap 62 63 0 1604.2 0.6 1.1X +getBoolean: Off-heap 62 62 0 1603.7 0.6 1.1X + + +================================================================================================ +Platform DirectBuffer Address Access +================================================================================================ + +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure +AMD EPYC 7763 64-Core Processor +DirectBuffer Address Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative +------------------------------------------------------------------------------------------------------------------------ +getLong (baseline) 161 164 2 619.3 1.6 1.0X +getDirectBufferAddress 359 362 6 278.8 3.6 0.5X ================================================================================================ Platform Bulk Operations 4k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 4k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 5.4 186.4 1.0X -copyMemory: Heap -> Off-heap 0 0 0 4.1 241.4 0.8X -copyMemory: Off-heap -> Heap 0 0 0 4.4 225.5 0.8X -copyMemory: Heap -> Heap 0 0 0 4.3 231.4 0.8X +copyMemory: Off-heap -> Off-heap 0 0 0 5.4 186.3 1.0X +copyMemory: Heap -> Off-heap 0 0 0 5.5 181.3 1.0X +copyMemory: Off-heap -> Heap 0 0 0 4.3 233.4 0.8X +copyMemory: Heap -> Heap 0 0 0 4.2 238.4 0.8X manual: Heap -> Heap 0 0 0 0.9 1062.9 0.2X manual: Off-heap -> Heap 0 0 0 1.0 960.7 0.2X setMemory: Off-heap 0 0 0 3.0 336.6 0.6X @@ -117,97 +129,97 @@ setMemory: Off-heap 0 0 Platform Bulk Operations 16k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 16k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 0.7 1526.9 1.0X -copyMemory: Heap -> Off-heap 0 0 0 0.7 1336.5 1.1X -copyMemory: Off-heap -> Heap 0 0 0 0.7 1425.6 1.1X -copyMemory: Heap -> Heap 0 0 0 0.7 1358.6 1.1X -manual: Heap -> Heap 0 0 0 0.2 5434.1 0.3X -manual: Off-heap -> Heap 0 0 0 0.3 3906.2 0.4X -setMemory: Off-heap 0 0 0 0.8 1293.3 1.2X +copyMemory: Off-heap -> Off-heap 0 0 0 0.7 1333.5 1.0X +copyMemory: Heap -> Off-heap 0 0 0 0.8 1302.4 1.0X +copyMemory: Off-heap -> Heap 0 0 0 0.8 1295.4 1.0X +copyMemory: Heap -> Heap 0 0 0 0.8 1314.4 1.0X +manual: Heap -> Heap 0 0 0 0.2 5434.1 0.2X +manual: Off-heap -> Heap 0 0 0 0.3 3880.2 0.3X +setMemory: Off-heap 0 0 0 0.8 1295.4 1.0X ================================================================================================ Platform Bulk Operations 256k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 256k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 0.0 26855.1 1.0X -copyMemory: Heap -> Off-heap 0 0 0 0.0 26615.6 1.0X -copyMemory: Off-heap -> Heap 0 0 0 0.0 25575.7 1.1X -copyMemory: Heap -> Heap 0 0 0 0.0 25511.5 1.1X -manual: Heap -> Heap 1 1 0 0.0 87430.0 0.3X -manual: Off-heap -> Heap 1 1 0 0.0 62307.2 0.4X -setMemory: Off-heap 0 0 0 0.0 20416.1 1.3X +copyMemory: Off-heap -> Off-heap 0 0 0 0.0 28443.0 1.0X +copyMemory: Heap -> Off-heap 0 0 0 0.0 26028.5 1.1X +copyMemory: Off-heap -> Heap 0 0 0 0.0 25912.2 1.1X +copyMemory: Heap -> Heap 0 0 0 0.0 33938.2 0.8X +manual: Heap -> Heap 1 1 0 0.0 88003.9 0.3X +manual: Off-heap -> Heap 1 1 0 0.0 62405.3 0.5X +setMemory: Off-heap 0 0 0 0.0 20392.0 1.4X ================================================================================================ Platform Bulk Operations 1m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 1m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 1 1 0 0.0 144063.6 1.0X -copyMemory: Heap -> Off-heap 1 1 0 0.0 136948.4 1.1X -copyMemory: Off-heap -> Heap 1 1 0 0.0 136958.4 1.1X -copyMemory: Heap -> Heap 1 1 0 0.0 137138.7 1.1X -manual: Heap -> Heap 3 3 0 0.0 274832.5 0.5X -manual: Off-heap -> Heap 3 3 0 0.0 250522.1 0.6X -setMemory: Off-heap 1 1 0 0.0 81296.7 1.8X +copyMemory: Off-heap -> Off-heap 1 1 0 0.0 110005.9 1.0X +copyMemory: Heap -> Off-heap 1 1 0 0.0 137549.3 0.8X +copyMemory: Off-heap -> Heap 1 1 0 0.0 113903.2 1.0X +copyMemory: Heap -> Heap 1 1 0 0.0 104773.2 1.0X +manual: Heap -> Heap 3 3 0 0.0 275027.4 0.4X +manual: Off-heap -> Heap 3 3 0 0.0 250247.1 0.4X +setMemory: Off-heap 1 1 0 0.0 81375.6 1.4X ================================================================================================ Platform Bulk Operations 8m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 8m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 14 14 0 0.0 1382687.3 1.0X -copyMemory: Heap -> Off-heap 17 18 0 0.0 1729538.1 0.8X -copyMemory: Off-heap -> Heap 17 17 0 0.0 1677423.9 0.8X -copyMemory: Heap -> Heap 17 17 0 0.0 1666798.1 0.8X -manual: Heap -> Heap 25 26 0 0.0 2509961.4 0.6X -manual: Off-heap -> Heap 25 26 0 0.0 2499264.5 0.6X -setMemory: Off-heap 8 10 1 0.0 796434.1 1.7X +copyMemory: Off-heap -> Off-heap 21 22 1 0.0 2148373.2 1.0X +copyMemory: Heap -> Off-heap 20 21 1 0.0 2007105.2 1.1X +copyMemory: Off-heap -> Heap 18 19 0 0.0 1806725.4 1.2X +copyMemory: Heap -> Heap 17 18 0 0.0 1693027.6 1.3X +manual: Heap -> Heap 25 25 0 0.0 2494245.2 0.9X +manual: Off-heap -> Heap 28 29 0 0.0 2782226.8 0.8X +setMemory: Off-heap 10 11 1 0.0 1025418.5 2.1X ================================================================================================ Platform Bulk Operations 32m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 32m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 78 79 1 0.0 7763257.0 1.0X -copyMemory: Heap -> Off-heap 84 85 1 0.0 8381141.4 0.9X -copyMemory: Off-heap -> Heap 83 85 1 0.0 8338717.4 0.9X -copyMemory: Heap -> Heap 84 85 2 0.0 8357496.5 0.9X -manual: Heap -> Heap 104 107 7 0.0 10358296.5 0.7X -manual: Off-heap -> Heap 108 110 1 0.0 10802113.1 0.7X -setMemory: Off-heap 55 57 1 0.0 5479064.0 1.4X +copyMemory: Off-heap -> Off-heap 77 78 1 0.0 7699847.8 1.0X +copyMemory: Heap -> Off-heap 83 84 1 0.0 8263815.4 0.9X +copyMemory: Off-heap -> Heap 83 86 2 0.0 8267087.5 0.9X +copyMemory: Heap -> Heap 82 84 3 0.0 8189359.5 0.9X +manual: Heap -> Heap 103 107 6 0.0 10332070.6 0.7X +manual: Off-heap -> Heap 108 110 1 0.0 10783091.0 0.7X +setMemory: Off-heap 54 56 1 0.0 5444755.2 1.4X ================================================================================================ Platform Memory Allocation 4k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 4k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 50000.0 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.0X +allocateMemory 0 0 0 40000.0 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 1.3X reallocateMemory: double in size 0 0 0 7662.8 0.1 0.2X @@ -215,64 +227,64 @@ reallocateMemory: double in size 0 0 Platform Memory Allocation 16k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 16k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 50000.0 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.0X -reallocateMemory: double in size 0 0 0 864.3 1.2 0.0X +allocateMemory 0 0 0 40816.3 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 1.2X +reallocateMemory: double in size 0 0 0 1447.2 0.7 0.0X ================================================================================================ Platform Memory Allocation 256k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 256k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 50000.0 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.0X -reallocateMemory: double in size 0 0 0 46.2 21.7 0.0X +allocateMemory 0 0 0 25000.0 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 2.0X +reallocateMemory: double in size 0 0 0 57.4 17.4 0.0X ================================================================================================ Platform Memory Allocation 1m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 1m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 50000.0 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.0X -reallocateMemory: double in size 0 0 0 14.1 71.0 0.0X +allocateMemory 0 0 0 25000.0 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 2.0X +reallocateMemory: double in size 0 0 0 14.8 67.6 0.0X ================================================================================================ Platform Memory Allocation 8m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 8m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 468.6 2.1 1.0X -freeMemory 0 0 0 333.8 3.0 0.7X -reallocateMemory: double in size 2 2 0 0.9 1097.5 0.0X +allocateMemory 0 0 0 22471.9 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 2.2X +reallocateMemory: double in size 3 3 0 0.7 1437.6 0.0X ================================================================================================ Platform Memory Allocation 32m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 21.0.10+7-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 32m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 475.3 2.1 1.0X -freeMemory 0 0 0 289.3 3.5 0.6X -reallocateMemory: double in size 11 11 0 0.2 5503.5 0.0X +allocateMemory 0 0 0 506.7 2.0 1.0X +freeMemory 0 0 0 300.2 3.3 0.6X +reallocateMemory: double in size 10 10 0 0.2 4957.9 0.0X diff --git a/core/benchmarks/PlatformBenchmark-jdk25-results.txt b/core/benchmarks/PlatformBenchmark-jdk25-results.txt index 06a1792a67f08..1d38f60aa9675 100644 --- a/core/benchmarks/PlatformBenchmark-jdk25-results.txt +++ b/core/benchmarks/PlatformBenchmark-jdk25-results.txt @@ -2,277 +2,289 @@ Platform Byte Access ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Byte Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putByte: On-heap 61 61 0 1645.1 0.6 1.0X -putByte: Off-heap 78 78 0 1281.6 0.8 0.8X -getByte: On-heap 52 52 0 1912.1 0.5 1.2X -getByte: Off-heap 52 52 0 1909.8 0.5 1.2X +putByte: On-heap 61 61 0 1641.9 0.6 1.0X +putByte: Off-heap 78 78 0 1278.6 0.8 0.8X +getByte: On-heap 52 52 0 1909.5 0.5 1.2X +getByte: Off-heap 52 52 0 1909.5 0.5 1.2X ================================================================================================ Platform Short Access ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Short Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putShort: On-heap 61 62 0 1627.3 0.6 1.0X -putShort: Off-heap 76 76 0 1317.8 0.8 0.8X -getShort: On-heap 41 41 0 2420.1 0.4 1.5X -getShort: Off-heap 50 50 0 1992.3 0.5 1.2X +putShort: On-heap 62 62 0 1613.9 0.6 1.0X +putShort: Off-heap 77 77 0 1302.9 0.8 0.8X +getShort: On-heap 41 41 0 2415.0 0.4 1.5X +getShort: Off-heap 50 51 0 1984.2 0.5 1.2X ================================================================================================ Platform Int Access ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Int Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putInt: On-heap 44 44 0 2260.5 0.4 1.0X -putInt: Off-heap 56 56 0 1795.5 0.6 0.8X -getInt: On-heap 34 34 0 2972.8 0.3 1.3X -getInt: Off-heap 40 40 0 2502.6 0.4 1.1X +putInt: On-heap 44 45 0 2252.3 0.4 1.0X +putInt: Off-heap 56 56 0 1793.7 0.6 0.8X +getInt: On-heap 34 34 0 2951.0 0.3 1.3X +getInt: Off-heap 40 40 0 2498.8 0.4 1.1X ================================================================================================ Platform Long Access ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Long Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putLong: On-heap 68 68 1 1478.1 0.7 1.0X -putLong: Off-heap 54 54 0 1858.3 0.5 1.3X -getLong: On-heap 40 41 1 2514.0 0.4 1.7X -getLong: Off-heap 43 45 1 2308.7 0.4 1.6X +putLong: On-heap 68 68 0 1468.5 0.7 1.0X +putLong: Off-heap 54 54 1 1863.7 0.5 1.3X +getLong: On-heap 40 41 1 2522.4 0.4 1.7X +getLong: Off-heap 44 45 1 2288.5 0.4 1.6X ================================================================================================ Platform Float Access ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Float Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putFloat: On-heap 44 44 0 2262.0 0.4 1.0X +putFloat: On-heap 44 44 0 2282.3 0.4 1.0X putFloat: Off-heap 50 50 0 2019.5 0.5 0.9X -getFloat: On-heap 94 94 0 1068.9 0.9 0.5X -getFloat: Off-heap 94 94 0 1068.1 0.9 0.5X +getFloat: On-heap 94 94 0 1068.3 0.9 0.5X +getFloat: Off-heap 94 94 0 1067.4 0.9 0.5X ================================================================================================ Platform Double Access ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Double Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putDouble: On-heap 46 47 0 2168.0 0.5 1.0X -putDouble: Off-heap 52 52 0 1931.2 0.5 0.9X -getDouble: On-heap 94 94 0 1061.9 0.9 0.5X -getDouble: Off-heap 95 95 0 1058.1 0.9 0.5X +putDouble: On-heap 46 47 1 2159.7 0.5 1.0X +putDouble: Off-heap 52 52 1 1931.1 0.5 0.9X +getDouble: On-heap 94 94 0 1061.3 0.9 0.5X +getDouble: Off-heap 94 95 0 1059.0 0.9 0.5X ================================================================================================ Platform Boolean Access ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Boolean Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putBoolean: On-heap 68 70 5 1469.9 0.7 1.0X -putBoolean: Off-heap 52 52 0 1929.7 0.5 1.3X -getBoolean: On-heap 62 62 0 1605.4 0.6 1.1X -getBoolean: Off-heap 62 62 0 1603.2 0.6 1.1X +putBoolean: On-heap 68 68 0 1468.3 0.7 1.0X +putBoolean: Off-heap 52 52 0 1928.6 0.5 1.3X +getBoolean: On-heap 62 62 0 1603.6 0.6 1.1X +getBoolean: Off-heap 62 63 0 1602.4 0.6 1.1X + + +================================================================================================ +Platform DirectBuffer Address Access +================================================================================================ + +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure +AMD EPYC 7763 64-Core Processor +DirectBuffer Address Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative +------------------------------------------------------------------------------------------------------------------------ +getLong (baseline) 154 159 4 648.9 1.5 1.0X +getDirectBufferAddress 329 335 4 303.8 3.3 0.5X ================================================================================================ Platform Bulk Operations 4k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 4k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ copyMemory: Off-heap -> Off-heap 0 0 0 5.4 186.3 1.0X -copyMemory: Heap -> Off-heap 0 0 0 4.6 216.4 0.9X -copyMemory: Off-heap -> Heap 0 0 0 4.0 250.4 0.7X -copyMemory: Heap -> Heap 0 0 0 4.6 218.4 0.9X +copyMemory: Heap -> Off-heap 0 0 0 4.3 230.4 0.8X +copyMemory: Off-heap -> Heap 0 0 0 5.6 177.3 1.1X +copyMemory: Heap -> Heap 0 0 0 5.4 185.4 1.0X manual: Heap -> Heap 0 0 0 0.9 1115.0 0.2X manual: Off-heap -> Heap 0 0 0 1.0 958.7 0.2X -setMemory: Off-heap 0 0 0 3.1 321.6 0.6X +setMemory: Off-heap 0 0 0 3.1 322.6 0.6X ================================================================================================ Platform Bulk Operations 16k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 16k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 0.8 1297.4 1.0X -copyMemory: Heap -> Off-heap 0 0 0 0.7 1374.5 0.9X -copyMemory: Off-heap -> Heap 0 0 0 0.8 1307.4 1.0X -copyMemory: Heap -> Heap 0 0 0 0.8 1308.4 1.0X -manual: Heap -> Heap 0 0 0 0.2 5481.2 0.2X -manual: Off-heap -> Heap 0 0 0 0.3 3927.3 0.3X -setMemory: Off-heap 0 0 0 0.8 1286.3 1.0X +copyMemory: Off-heap -> Off-heap 0 0 0 0.8 1294.4 1.0X +copyMemory: Heap -> Off-heap 0 0 0 0.7 1366.6 0.9X +copyMemory: Off-heap -> Heap 0 0 0 0.7 1381.6 0.9X +copyMemory: Heap -> Heap 0 0 0 0.7 1385.7 0.9X +manual: Heap -> Heap 0 0 0 0.2 5502.3 0.2X +manual: Off-heap -> Heap 0 0 0 0.3 3946.4 0.3X +setMemory: Off-heap 0 0 0 0.8 1286.4 1.0X ================================================================================================ Platform Bulk Operations 256k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 256k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 0.0 28214.6 1.0X -copyMemory: Heap -> Off-heap 0 0 0 0.0 25715.9 1.1X -copyMemory: Off-heap -> Heap 0 0 0 0.0 26025.5 1.1X -copyMemory: Heap -> Heap 0 0 0 0.0 25499.4 1.1X -manual: Heap -> Heap 1 1 0 0.0 89010.7 0.3X -manual: Off-heap -> Heap 1 1 0 0.0 64418.9 0.4X -setMemory: Off-heap 0 0 0 0.0 20724.7 1.4X +copyMemory: Off-heap -> Off-heap 0 0 0 0.0 29367.2 1.0X +copyMemory: Heap -> Off-heap 0 0 0 0.0 26129.1 1.1X +copyMemory: Off-heap -> Heap 0 0 0 0.0 25692.3 1.1X +copyMemory: Heap -> Heap 0 0 0 0.0 25556.1 1.1X +manual: Heap -> Heap 1 1 0 0.0 71480.4 0.4X +manual: Off-heap -> Heap 1 1 0 0.0 62589.7 0.5X +setMemory: Off-heap 0 0 0 0.0 20488.5 1.4X ================================================================================================ Platform Bulk Operations 1m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 1m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 1 1 0 0.0 106262.8 1.0X -copyMemory: Heap -> Off-heap 1 1 0 0.0 104618.6 1.0X -copyMemory: Off-heap -> Heap 1 1 0 0.0 104421.3 1.0X -copyMemory: Heap -> Heap 1 1 0 0.0 103696.0 1.0X -manual: Heap -> Heap 3 3 0 0.0 287286.8 0.4X -manual: Off-heap -> Heap 3 3 0 0.0 254099.0 0.4X -setMemory: Off-heap 1 1 0 0.0 81383.4 1.3X +copyMemory: Off-heap -> Off-heap 1 1 0 0.0 103428.5 1.0X +copyMemory: Heap -> Off-heap 1 1 0 0.0 104011.6 1.0X +copyMemory: Off-heap -> Heap 1 1 0 0.0 103916.4 1.0X +copyMemory: Heap -> Heap 1 1 0 0.0 104673.9 1.0X +manual: Heap -> Heap 3 3 0 0.0 287721.0 0.4X +manual: Off-heap -> Heap 3 3 0 0.0 252355.6 0.4X +setMemory: Off-heap 1 1 0 0.0 82176.6 1.3X ================================================================================================ Platform Bulk Operations 8m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 8m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 14 16 1 0.0 1408711.6 1.0X -copyMemory: Heap -> Off-heap 16 17 1 0.0 1592233.3 0.9X -copyMemory: Off-heap -> Heap 16 17 0 0.0 1580333.7 0.9X -copyMemory: Heap -> Heap 16 17 1 0.0 1594253.6 0.9X -manual: Heap -> Heap 25 25 0 0.0 2473883.8 0.6X -manual: Off-heap -> Heap 25 26 1 0.0 2500358.3 0.6X -setMemory: Off-heap 8 13 1 0.0 849445.6 1.7X +copyMemory: Off-heap -> Off-heap 20 22 1 0.0 2037981.7 1.0X +copyMemory: Heap -> Off-heap 20 20 0 0.0 1986022.1 1.0X +copyMemory: Off-heap -> Heap 17 18 1 0.0 1705983.5 1.2X +copyMemory: Heap -> Heap 16 17 1 0.0 1610255.5 1.3X +manual: Heap -> Heap 25 25 0 0.0 2484988.6 0.8X +manual: Off-heap -> Heap 27 28 0 0.0 2707546.2 0.8X +setMemory: Off-heap 12 14 1 0.0 1197866.2 1.7X ================================================================================================ Platform Bulk Operations 32m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 32m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 75 77 1 0.0 7519485.5 1.0X -copyMemory: Heap -> Off-heap 83 86 2 0.0 8296719.9 0.9X -copyMemory: Off-heap -> Heap 79 82 2 0.0 7949268.1 0.9X -copyMemory: Heap -> Heap 78 81 2 0.0 7825109.7 1.0X -manual: Heap -> Heap 100 101 1 0.0 10000320.7 0.8X -manual: Off-heap -> Heap 101 105 2 0.0 10118767.2 0.7X -setMemory: Off-heap 58 62 2 0.0 5778583.5 1.3X +copyMemory: Off-heap -> Off-heap 77 79 1 0.0 7748515.9 1.0X +copyMemory: Heap -> Off-heap 82 84 2 0.0 8163292.9 0.9X +copyMemory: Off-heap -> Heap 80 83 2 0.0 7979049.4 1.0X +copyMemory: Heap -> Heap 78 80 1 0.0 7840213.0 1.0X +manual: Heap -> Heap 101 103 3 0.0 10077287.6 0.8X +manual: Off-heap -> Heap 102 106 2 0.0 10208030.5 0.8X +setMemory: Off-heap 59 60 1 0.0 5877037.2 1.3X ================================================================================================ Platform Memory Allocation 4k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 4k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 50000.0 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.0X -reallocateMemory: double in size 0 0 0 6666.7 0.2 0.1X +allocateMemory 0 0 0 68965.5 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 0.7X +reallocateMemory: double in size 0 0 0 6250.0 0.2 0.1X ================================================================================================ Platform Memory Allocation 16k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 16k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ allocateMemory 0 0 0 40816.3 0.0 1.0X freeMemory 0 0 0 50000.0 0.0 1.2X -reallocateMemory: double in size 0 0 0 713.0 1.4 0.0X +reallocateMemory: double in size 0 0 0 1435.8 0.7 0.0X ================================================================================================ Platform Memory Allocation 256k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 256k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 40816.3 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.2X -reallocateMemory: double in size 0 0 0 40.9 24.4 0.0X +allocateMemory 0 0 0 25000.0 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 2.0X +reallocateMemory: double in size 0 0 0 66.5 15.0 0.0X ================================================================================================ Platform Memory Allocation 1m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 1m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 40816.3 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.2X -reallocateMemory: double in size 0 0 0 19.5 51.4 0.0X +allocateMemory 0 0 0 28985.5 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 1.7X +reallocateMemory: double in size 0 0 0 19.4 51.5 0.0X ================================================================================================ Platform Memory Allocation 8m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 8m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 464.1 2.2 1.0X -freeMemory 0 0 0 329.4 3.0 0.7X -reallocateMemory: double in size 2 2 0 0.9 1109.9 0.0X +allocateMemory 0 0 0 25000.0 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 2.0X +reallocateMemory: double in size 3 3 0 0.7 1350.9 0.0X ================================================================================================ Platform Memory Allocation 32m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 25.0.2+10-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 32m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 463.3 2.2 1.0X -freeMemory 0 0 0 284.4 3.5 0.6X -reallocateMemory: double in size 10 10 0 0.2 4779.0 0.0X +allocateMemory 0 0 0 539.5 1.9 1.0X +freeMemory 0 0 0 311.4 3.2 0.6X +reallocateMemory: double in size 11 12 2 0.2 5376.3 0.0X diff --git a/core/benchmarks/PlatformBenchmark-results.txt b/core/benchmarks/PlatformBenchmark-results.txt index 9eb9699df33e8..2ce5c7d604af3 100644 --- a/core/benchmarks/PlatformBenchmark-results.txt +++ b/core/benchmarks/PlatformBenchmark-results.txt @@ -2,113 +2,125 @@ Platform Byte Access ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Byte Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putByte: On-heap 63 63 0 1590.5 0.6 1.0X -putByte: Off-heap 80 80 0 1245.7 0.8 0.8X -getByte: On-heap 59 59 0 1685.7 0.6 1.1X -getByte: Off-heap 47 48 1 2112.6 0.5 1.3X +putByte: On-heap 63 63 0 1592.6 0.6 1.0X +putByte: Off-heap 78 78 0 1282.3 0.8 0.8X +getByte: On-heap 59 60 0 1684.2 0.6 1.1X +getByte: Off-heap 47 47 0 2110.6 0.5 1.3X ================================================================================================ Platform Short Access ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Short Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putShort: On-heap 63 63 1 1586.2 0.6 1.0X -putShort: Off-heap 119 119 0 839.2 1.2 0.5X -getShort: On-heap 44 44 0 2256.6 0.4 1.4X -getShort: Off-heap 57 57 0 1761.1 0.6 1.1X +putShort: On-heap 63 63 0 1581.9 0.6 1.0X +putShort: Off-heap 119 119 0 838.3 1.2 0.5X +getShort: On-heap 44 44 0 2256.3 0.4 1.4X +getShort: Off-heap 57 57 1 1760.7 0.6 1.1X ================================================================================================ Platform Int Access ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Int Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putInt: On-heap 42 42 0 2369.5 0.4 1.0X -putInt: Off-heap 50 50 0 2000.7 0.5 0.8X -getInt: On-heap 34 34 0 2941.2 0.3 1.2X -getInt: Off-heap 49 49 0 2034.2 0.5 0.9X +putInt: On-heap 42 42 0 2386.5 0.4 1.0X +putInt: Off-heap 50 50 0 2009.2 0.5 0.8X +getInt: On-heap 33 34 4 2988.7 0.3 1.3X +getInt: Off-heap 49 49 0 2053.4 0.5 0.9X ================================================================================================ Platform Long Access ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Long Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putLong: On-heap 65 65 0 1546.6 0.6 1.0X -putLong: Off-heap 48 48 0 2084.7 0.5 1.3X -getLong: On-heap 40 42 1 2493.5 0.4 1.6X -getLong: Off-heap 52 52 0 1941.1 0.5 1.3X +putLong: On-heap 65 66 0 1534.8 0.7 1.0X +putLong: Off-heap 48 50 4 2071.2 0.5 1.3X +getLong: On-heap 42 43 1 2393.8 0.4 1.6X +getLong: Off-heap 51 52 1 1945.4 0.5 1.3X ================================================================================================ Platform Float Access ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Float Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putFloat: On-heap 47 47 0 2115.7 0.5 1.0X -putFloat: Off-heap 63 63 0 1596.2 0.6 0.8X -getFloat: On-heap 94 94 0 1068.3 0.9 0.5X -getFloat: Off-heap 94 94 0 1067.6 0.9 0.5X +putFloat: On-heap 47 47 0 2119.8 0.5 1.0X +putFloat: Off-heap 63 63 0 1597.1 0.6 0.8X +getFloat: On-heap 94 94 0 1068.2 0.9 0.5X +getFloat: Off-heap 94 94 0 1067.9 0.9 0.5X ================================================================================================ Platform Double Access ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Double Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putDouble: On-heap 49 49 0 2043.5 0.5 1.0X -putDouble: Off-heap 64 64 0 1562.3 0.6 0.8X -getDouble: On-heap 94 94 0 1061.5 0.9 0.5X -getDouble: Off-heap 95 95 0 1057.1 0.9 0.5X +putDouble: On-heap 49 49 0 2048.2 0.5 1.0X +putDouble: Off-heap 64 64 0 1558.9 0.6 0.8X +getDouble: On-heap 95 95 0 1058.0 0.9 0.5X +getDouble: Off-heap 95 95 0 1055.4 0.9 0.5X ================================================================================================ Platform Boolean Access ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Boolean Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -putBoolean: On-heap 78 78 0 1279.0 0.8 1.0X -putBoolean: Off-heap 76 76 1 1314.5 0.8 1.0X -getBoolean: On-heap 62 62 0 1604.5 0.6 1.3X +putBoolean: On-heap 78 78 0 1279.4 0.8 1.0X +putBoolean: Off-heap 78 80 6 1286.9 0.8 1.0X +getBoolean: On-heap 62 62 0 1603.5 0.6 1.3X getBoolean: Off-heap 62 63 0 1601.0 0.6 1.3X +================================================================================================ +Platform DirectBuffer Address Access +================================================================================================ + +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure +AMD EPYC 7763 64-Core Processor +DirectBuffer Address Access: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative +------------------------------------------------------------------------------------------------------------------------ +getLong (baseline) 156 159 2 640.4 1.6 1.0X +getDirectBufferAddress 325 327 2 308.1 3.2 0.5X + + ================================================================================================ Platform Bulk Operations 4k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 4k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 5.4 184.3 1.0X -copyMemory: Heap -> Off-heap 0 0 0 1.6 608.2 0.3X -copyMemory: Off-heap -> Heap 0 0 0 4.9 202.3 0.9X -copyMemory: Heap -> Heap 0 0 0 4.7 211.3 0.9X -manual: Heap -> Heap 0 0 0 0.9 1063.0 0.2X +copyMemory: Off-heap -> Off-heap 0 0 0 5.4 186.3 1.0X +copyMemory: Heap -> Off-heap 0 0 0 4.4 228.4 0.8X +copyMemory: Off-heap -> Heap 0 0 0 5.0 199.3 0.9X +copyMemory: Heap -> Heap 0 0 0 4.8 206.4 0.9X +manual: Heap -> Heap 0 0 0 0.9 1116.0 0.2X manual: Off-heap -> Heap 0 0 0 1.0 960.7 0.2X setMemory: Off-heap 0 0 0 1.5 649.2 0.3X @@ -117,162 +129,162 @@ setMemory: Off-heap 0 0 Platform Bulk Operations 16k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 16k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 0.8 1294.4 1.0X -copyMemory: Heap -> Off-heap 0 0 0 0.7 1414.7 0.9X -copyMemory: Off-heap -> Heap 0 0 0 0.8 1287.4 1.0X -copyMemory: Heap -> Heap 0 0 0 0.8 1286.4 1.0X -manual: Heap -> Heap 0 0 0 0.2 5439.1 0.2X -manual: Off-heap -> Heap 0 0 0 0.3 3849.2 0.3X -setMemory: Off-heap 0 0 0 0.4 2552.7 0.5X +copyMemory: Off-heap -> Off-heap 0 0 0 0.8 1305.5 1.0X +copyMemory: Heap -> Off-heap 0 0 0 0.8 1289.4 1.0X +copyMemory: Off-heap -> Heap 0 0 0 0.8 1322.4 1.0X +copyMemory: Heap -> Heap 0 0 0 0.7 1401.6 0.9X +manual: Heap -> Heap 0 0 0 0.2 5420.2 0.2X +manual: Off-heap -> Heap 0 0 0 0.3 3946.4 0.3X +setMemory: Off-heap 0 0 0 0.4 2548.7 0.5X ================================================================================================ Platform Bulk Operations 256k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 256k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 0 0 0 0.0 27951.4 1.0X -copyMemory: Heap -> Off-heap 0 0 0 0.0 27292.1 1.0X -copyMemory: Off-heap -> Heap 0 0 0 0.0 25880.5 1.1X -copyMemory: Heap -> Heap 0 0 0 0.0 25672.1 1.1X -manual: Heap -> Heap 1 1 0 0.0 88010.9 0.3X -manual: Off-heap -> Heap 1 1 0 0.0 62301.7 0.4X -setMemory: Off-heap 0 0 0 0.0 40585.0 0.7X +copyMemory: Off-heap -> Off-heap 0 0 0 0.0 25903.4 1.0X +copyMemory: Heap -> Off-heap 0 0 0 0.0 25576.8 1.0X +copyMemory: Off-heap -> Heap 0 0 0 0.0 25723.1 1.0X +copyMemory: Heap -> Heap 0 0 0 0.0 25510.7 1.0X +manual: Heap -> Heap 1 1 0 0.0 71333.3 0.4X +manual: Off-heap -> Heap 1 1 0 0.0 62080.1 0.4X +setMemory: Off-heap 0 0 0 0.0 40571.8 0.6X ================================================================================================ Platform Bulk Operations 1m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 1m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 1 2 0 0.0 138711.9 1.0X -copyMemory: Heap -> Off-heap 1 1 0 0.0 104891.6 1.3X -copyMemory: Off-heap -> Heap 1 1 0 0.0 104430.8 1.3X -copyMemory: Heap -> Heap 1 1 0 0.0 103958.9 1.3X -manual: Heap -> Heap 3 3 0 0.0 274934.2 0.5X -manual: Off-heap -> Heap 3 3 1 0.0 252551.2 0.5X -setMemory: Off-heap 2 2 0 0.0 162971.4 0.9X +copyMemory: Off-heap -> Off-heap 1 1 0 0.0 132795.2 1.0X +copyMemory: Heap -> Off-heap 2 2 0 0.0 195968.4 0.7X +copyMemory: Off-heap -> Heap 1 1 0 0.0 104412.2 1.3X +copyMemory: Heap -> Heap 1 1 0 0.0 103728.0 1.3X +manual: Heap -> Heap 3 3 0 0.0 287306.2 0.5X +manual: Off-heap -> Heap 3 3 0 0.0 252722.5 0.5X +setMemory: Off-heap 2 2 0 0.0 163130.2 0.8X ================================================================================================ Platform Bulk Operations 8m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 8m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 15 16 0 0.0 1494501.6 1.0X -copyMemory: Heap -> Off-heap 17 18 0 0.0 1696782.5 0.9X -copyMemory: Off-heap -> Heap 17 17 0 0.0 1674377.6 0.9X -copyMemory: Heap -> Heap 17 17 0 0.0 1665476.9 0.9X -manual: Heap -> Heap 25 25 0 0.0 2459913.6 0.6X -manual: Off-heap -> Heap 25 25 0 0.0 2455565.3 0.6X -setMemory: Off-heap 14 15 0 0.0 1409985.1 1.1X +copyMemory: Off-heap -> Off-heap 19 20 0 0.0 1896040.1 1.0X +copyMemory: Heap -> Off-heap 20 22 1 0.0 2046607.6 0.9X +copyMemory: Off-heap -> Heap 19 20 0 0.0 1879749.7 1.0X +copyMemory: Heap -> Heap 17 18 0 0.0 1717599.3 1.1X +manual: Heap -> Heap 25 25 1 0.0 2461400.1 0.8X +manual: Off-heap -> Heap 27 27 0 0.0 2675801.9 0.7X +setMemory: Off-heap 15 15 0 0.0 1476851.3 1.3X ================================================================================================ Platform Bulk Operations 32m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Bulk Operations 32m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -copyMemory: Off-heap -> Off-heap 77 77 1 0.0 7664570.1 1.0X -copyMemory: Heap -> Off-heap 84 86 1 0.0 8400167.3 0.9X -copyMemory: Off-heap -> Heap 81 85 1 0.0 8115112.6 0.9X -copyMemory: Heap -> Heap 82 84 1 0.0 8232211.9 0.9X -manual: Heap -> Heap 99 100 1 0.0 9924878.4 0.8X -manual: Off-heap -> Heap 101 103 1 0.0 10107944.3 0.8X -setMemory: Off-heap 59 60 1 0.0 5916000.3 1.3X +copyMemory: Off-heap -> Off-heap 76 77 1 0.0 7571838.0 1.0X +copyMemory: Heap -> Off-heap 87 90 2 0.0 8706587.6 0.9X +copyMemory: Off-heap -> Heap 80 83 3 0.0 7977628.2 0.9X +copyMemory: Heap -> Heap 82 83 0 0.0 8188052.7 0.9X +manual: Heap -> Heap 99 103 8 0.0 9910843.4 0.8X +manual: Off-heap -> Heap 99 101 2 0.0 9905358.2 0.8X +setMemory: Off-heap 59 61 1 0.0 5866641.1 1.3X ================================================================================================ Platform Memory Allocation 4k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 4k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ allocateMemory 0 0 0 40816.3 0.0 1.0X freeMemory 0 0 0 50000.0 0.0 1.2X -reallocateMemory: double in size 0 0 0 5882.4 0.2 0.1X +reallocateMemory: double in size 0 0 0 7662.8 0.1 0.2X ================================================================================================ Platform Memory Allocation 16k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 16k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ allocateMemory 0 0 0 40816.3 0.0 1.0X freeMemory 0 0 0 50000.0 0.0 1.2X -reallocateMemory: double in size 0 0 0 1296.2 0.8 0.0X +reallocateMemory: double in size 0 0 0 1457.7 0.7 0.0X ================================================================================================ Platform Memory Allocation 256k Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 256k Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 50000.0 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.0X -reallocateMemory: double in size 0 0 0 45.6 21.9 0.0X +allocateMemory 0 0 0 22471.9 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 2.2X +reallocateMemory: double in size 0 0 0 77.3 12.9 0.0X ================================================================================================ Platform Memory Allocation 1m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 1m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 50000.0 0.0 1.0X -freeMemory 0 0 0 50000.0 0.0 1.0X -reallocateMemory: double in size 0 0 0 13.5 73.9 0.0X +allocateMemory 0 0 0 20000.0 0.1 1.0X +freeMemory 0 0 0 50000.0 0.0 2.5X +reallocateMemory: double in size 0 0 0 11.3 88.8 0.0X ================================================================================================ Platform Memory Allocation 8m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 8m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 400.9 2.5 1.0X -freeMemory 0 0 0 386.8 2.6 1.0X -reallocateMemory: double in size 3 3 0 0.7 1384.4 0.0X +allocateMemory 0 0 0 22471.9 0.0 1.0X +freeMemory 0 0 0 50000.0 0.0 2.2X +reallocateMemory: double in size 3 3 0 0.7 1379.0 0.0X ================================================================================================ Platform Memory Allocation 32m Ints ================================================================================================ -OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.14.0-1017-azure +OpenJDK 64-Bit Server VM 17.0.18+8-LTS on Linux 6.17.0-1010-azure AMD EPYC 7763 64-Core Processor Memory Allocation 32m Ints: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -allocateMemory 0 0 0 476.5 2.1 1.0X -freeMemory 0 0 0 294.9 3.4 0.6X -reallocateMemory: double in size 11 11 0 0.2 5518.7 0.0X +allocateMemory 0 0 0 532.3 1.9 1.0X +freeMemory 0 0 0 304.3 3.3 0.6X +reallocateMemory: double in size 10 10 0 0.2 4796.7 0.0X diff --git a/core/src/test/scala/org/apache/spark/unsafe/PlatformBenchmark.scala b/core/src/test/scala/org/apache/spark/unsafe/PlatformBenchmark.scala index d314fe76fb317..d751e32c60610 100644 --- a/core/src/test/scala/org/apache/spark/unsafe/PlatformBenchmark.scala +++ b/core/src/test/scala/org/apache/spark/unsafe/PlatformBenchmark.scala @@ -17,6 +17,8 @@ package org.apache.spark.unsafe +import java.nio.ByteBuffer + import org.apache.spark.benchmark.{Benchmark, BenchmarkBase} /** @@ -55,6 +57,7 @@ object PlatformBenchmark extends BenchmarkBase { runFloatAccess(count8m, iterations) runDoubleAccess(count8m, iterations) runBooleanAccess(count8m, iterations) + runDirectBufferAddressAccess(count8m, iterations) val counts = Seq((count4k, str4k), (count16k, str16k), (count256k, str256k), (count1m, str1m), (count8m, str8m), (count32m, str32m)) @@ -441,6 +444,52 @@ object PlatformBenchmark extends BenchmarkBase { } } + private def runDirectBufferAddressAccess(count: Long, iterations: Long): Unit = { + val addresses = new Array[Long](count.toInt) + var j = 0 + while (j < count) { + addresses(j) = Platform.allocateMemory(8) + j += 1 + } + val buffers = new Array[ByteBuffer](count.toInt) + j = 0 + while (j < count) { + buffers(j) = ByteBuffer.allocateDirect(1) + j += 1 + } + val mask = count - 1 + try { + runBenchmark("Platform DirectBuffer Address Access") { + val benchmark = new Benchmark("DirectBuffer Address Access", iterations, output = output) + + benchmark.addCase("getLong (baseline)") { _ => + var i = 0L + var sum = 0L + while (i < iterations) { + sum += Platform.getLong(null, addresses((i & mask).toInt)) + i += 1 + } + } + + benchmark.addCase("getDirectBufferAddress") { _ => + var i = 0L + var sum = 0L + while (i < iterations) { + sum += Platform.getDirectBufferAddress(buffers((i & mask).toInt)) + i += 1 + } + } + benchmark.run() + } + } finally { + j = 0 + while (j < count) { + Platform.freeMemory(addresses(j)) + j += 1 + } + } + } + private def runBulkOperations(count: Long, countStr: String): Unit = { val size = count * 4 val address = Platform.allocateMemory(size) diff --git a/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedPlainValuesReader.java b/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedPlainValuesReader.java index a62b773c7f4f2..d792ba0d72594 100644 --- a/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedPlainValuesReader.java +++ b/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedPlainValuesReader.java @@ -475,9 +475,9 @@ public final void readBinary(int total, WritableColumnVector v, int rowId) { if (buffer.hasArray()) { v.putByteArray(rowId + i, buffer.array(), buffer.arrayOffset() + buffer.position(), len); } else { - byte[] bytes = new byte[len]; - buffer.get(bytes); - v.putByteArray(rowId + i, bytes); + // Copy directly from the ByteBuffer into the column vector's backing storage, + // bypassing any intermediate byte[] allocation. + v.putByteArray(rowId + i, buffer, buffer.position(), len); } } } diff --git a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java index c8554fb1b8fb3..ba740602b4c2b 100644 --- a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java +++ b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java @@ -203,6 +203,22 @@ public void putBytes(int rowId, int count, byte[] src, int srcIndex) { Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET + srcIndex, null, data + rowId, count); } + @Override + public void putBytes(int rowId, int count, ByteBuffer src, int srcIndex) { + if (src.hasArray()) { + Platform.copyMemory(src.array(), Platform.BYTE_ARRAY_OFFSET + src.arrayOffset() + srcIndex, + null, data + rowId, count); + } else if (src.isDirect()) { + long srcAddr = Platform.getDirectBufferAddress(src) + srcIndex; + Platform.copyMemory(null, srcAddr, null, data + rowId, count); + } else { + // Fallback for non-heap, non-direct buffers (e.g., read-only wrappers). + byte[] tmp = new byte[count]; + src.get(srcIndex, tmp, 0, count); + Platform.copyMemory(tmp, Platform.BYTE_ARRAY_OFFSET, null, data + rowId, count); + } + } + @Override public byte getByte(int rowId) { if (dictionary == null) { diff --git a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OnHeapColumnVector.java b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OnHeapColumnVector.java index ea516871584f7..3e1f4d7a4f838 100644 --- a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OnHeapColumnVector.java +++ b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OnHeapColumnVector.java @@ -201,6 +201,12 @@ public void putBytes(int rowId, int count, byte[] src, int srcIndex) { System.arraycopy(src, srcIndex, byteData, rowId, count); } + @Override + public void putBytes(int rowId, int count, ByteBuffer src, int srcIndex) { + // Absolute bulk get: single copy, does not modify src's position. + src.get(srcIndex, byteData, rowId, count); + } + @Override public byte getByte(int rowId) { if (dictionary == null) { diff --git a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java index 76d9d07239119..0f5b23ad85390 100644 --- a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java +++ b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java @@ -286,6 +286,12 @@ public void putBooleans(int rowId, int count, byte src, int srcIndex) { */ public abstract void putBytes(int rowId, int count, byte[] src, int srcIndex); + /** + * Copies {@code count} bytes from a {@link ByteBuffer} starting at absolute position + * {@code srcIndex} into this column at {@code rowId}. Does not modify the buffer's position. + */ + public abstract void putBytes(int rowId, int count, ByteBuffer src, int srcIndex); + /** * Sets `value` to the value at rowId. */ @@ -435,6 +441,25 @@ public final int putByteArray(int rowId, byte[] value) { return putByteArray(rowId, value, 0, value.length); } + /** + * Stores bytes from a {@link ByteBuffer} as a variable-length byte array at {@code rowId}. + * Copies {@code length} bytes starting at absolute position {@code srcPosition} in the buffer. + * Does not modify the buffer's position. + */ + public final int putByteArray(int rowId, ByteBuffer src, int srcPosition, int length) { + int result = arrayData().appendBytes(length, src, srcPosition); + putArray(rowId, result, length); + return result; + } + + final int appendBytes(int length, ByteBuffer src, int srcPosition) { + reserve(elementsAppended + length); + int result = elementsAppended; + putBytes(elementsAppended, length, src, srcPosition); + elementsAppended += length; + return result; + } + @Override public Decimal getDecimal(int rowId, int precision, int scale) { if (isNullAt(rowId)) return null; diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnVectorSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnVectorSuite.scala index 2dbf14d3275d0..8c84742c16efb 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnVectorSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnVectorSuite.scala @@ -17,6 +17,8 @@ package org.apache.spark.sql.execution.vectorized +import java.nio.ByteBuffer + import org.apache.spark.SparkFunSuite import org.apache.spark.sql.YearUDT import org.apache.spark.sql.catalyst.expressions.SpecificInternalRow @@ -262,6 +264,71 @@ class ColumnVectorSuite extends SparkFunSuite with SQLHelper { } } + testVectors("putByteArray from ByteBuffer", 10, BinaryType) { testVector => + def verifyPutByteArray(testVector: WritableColumnVector): Unit = { + (0 until 10).foreach { i => + assert(testVector.getBinary(i) === s"str$i".getBytes("utf8")) + } + } + + // Heap ByteBuffer + (0 until 10).foreach { i => + val bytes = s"str$i".getBytes("utf8") + testVector.putByteArray(i, ByteBuffer.wrap(bytes), 0, bytes.length) + } + verifyPutByteArray(testVector) + + // Direct ByteBuffer + testVector.reset() + (0 until 10).foreach { i => + val bytes = s"str$i".getBytes("utf8") + val buf = ByteBuffer.allocateDirect(bytes.length) + buf.put(bytes) + testVector.putByteArray(i, buf, 0, bytes.length) + } + verifyPutByteArray(testVector) + + // Read-only ByteBuffer (hasArray=false, isDirect=false) + testVector.reset() + (0 until 10).foreach { i => + val bytes = s"str$i".getBytes("utf8") + val buf = ByteBuffer.wrap(bytes).asReadOnlyBuffer() + testVector.putByteArray(i, buf, 0, bytes.length) + } + verifyPutByteArray(testVector) + } + + testVectors("putBytes from ByteBuffer", 16, ByteType) { testVector => + val data = Array[Byte](10, 20, 30, 40, 50, 60, 70, 80) + + // Heap ByteBuffer + testVector.putBytes(0, data.length, ByteBuffer.wrap(data), 0) + (0 until data.length).foreach { i => + assert(testVector.getByte(i) === data(i)) + } + + // Direct ByteBuffer + val directBuf = ByteBuffer.allocateDirect(data.length) + directBuf.put(data) + testVector.putBytes(0, data.length, directBuf, 0) + (0 until data.length).foreach { i => + assert(testVector.getByte(i) === data(i)) + } + + // Read-only ByteBuffer (hasArray=false, isDirect=false) + val readOnlyBuf = ByteBuffer.wrap(data).asReadOnlyBuffer() + testVector.putBytes(0, data.length, readOnlyBuf, 0) + (0 until data.length).foreach { i => + assert(testVector.getByte(i) === data(i)) + } + + // With srcIndex offset + testVector.putBytes(0, 4, ByteBuffer.wrap(data), 4) + (0 until 4).foreach { i => + assert(testVector.getByte(i) === data(i + 4)) + } + } + DataTypeTestUtils.yearMonthIntervalTypes.foreach { dt => testVectors(dt.typeName,