[PATCH] Reduce Chance Of Mistakenly Early Backing Memory Cleanup

Ben Walsh ben_walsh at uk.ibm.com
Thu Feb 8 16:22:32 UTC 2018


Hi Paul,

Following up with the requested loop and vectorization benchmarks ...


(Do the vectorization benchmark results imply that the Hotspot compiler 
has been unable to perform the vectorization optimisation due to the 
presence of the reachabilityFence ?)


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


Loop Benchmarking
---- ------------

package org.sample;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;

import java.nio.ByteBuffer;

@State(Scope.Benchmark)
public class ByteBufferBenchmark {

    @Param({"1", "10", "100", "1000", "10000"})
    public int L;

    @State(Scope.Benchmark)
    public static class ByteBufferContainer {

        ByteBuffer bb;

        @Setup(Level.Invocation)
        public void initByteBuffer() {
            bb = ByteBuffer.allocateDirect(10000);
        }

        ByteBuffer getByteBuffer() {
            return bb;
        }
    }

    @Benchmark
    public ByteBuffer benchmark_byte_buffer_put(ByteBufferContainer bbC) {
 
        ByteBuffer bb = bbC.getByteBuffer();

        for (int i = 0; i < L; i++) {
            bb.put((byte)i);
        }

        return bb;
    }

}


Without Changes

Benchmark                                        (L)   Mode  Cnt Score  
Error  Units
ByteBufferBenchmark.benchmark_byte_buffer_put      1  thrpt  200 
29303145.752 ± 635979.750  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put     10  thrpt  200 
24260859.017 ± 528891.303  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put    100  thrpt  200 
8512366.637 ± 136615.070  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put   1000  thrpt  200 
1323756.037 ±  21485.369  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put  10000  thrpt  200 
145965.305 ±   1301.469  ops/s


With Changes

Benchmark                                        (L)   Mode  Cnt Score  
Error  Units  Impact
ByteBufferBenchmark.benchmark_byte_buffer_put      1  thrpt  200 
28893540.122 ± 754554.747  ops/s  -1.398%
ByteBufferBenchmark.benchmark_byte_buffer_put     10  thrpt  200 
15317696.355 ± 231621.608  ops/s  -36.863%
ByteBufferBenchmark.benchmark_byte_buffer_put    100  thrpt  200 
2546599.578 ±  32136.873  ops/s  -70.084%
ByteBufferBenchmark.benchmark_byte_buffer_put   1000  thrpt  200 
288832.514 ±   3854.522  ops/s  -78.181%
ByteBufferBenchmark.benchmark_byte_buffer_put  10000  thrpt  200 29747.386 
±    214.831  ops/s  -79.620%


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


Vectorization Benchmarking
------------- ------------

package org.sample;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;

import java.nio.ByteBuffer;

@State(Scope.Benchmark)
public class ByteBufferBenchmark {

    @Param({"1", "10", "100", "1000", "10000"})
    public int L;

    @State(Scope.Benchmark)
    public static class ByteBufferContainer {

        ByteBuffer bb;

        @Setup(Level.Invocation)
        public void initByteBuffer() {
            bb = ByteBuffer.allocateDirect(4 * 10000);
 
            for (int i = 0; i < 10000; i++) {
                bb.putInt(i);
            }
        }

        ByteBuffer getByteBuffer() {
            return bb;
        }

    }

    @Benchmark
    public int benchmark_byte_buffer_put(ByteBufferContainer bbC) {
 
        ByteBuffer bb = bbC.getByteBuffer();

        bb.position(0);

        int sum = 0;

        for (int i = 0; i < L; i++) {
            sum += bb.getInt();
        }

        return sum;

    }

}


Without Changes

Benchmark                                        (L)   Mode  Cnt Score  
Error  Units
ByteBufferBenchmark.benchmark_byte_buffer_put      1  thrpt  200 
29677205.748 ± 544721.142  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put     10  thrpt  200 
18219951.454 ± 320724.793  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put    100  thrpt  200 
7767650.826 ± 121798.910  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put   1000  thrpt  200 
1646075.010 ±   9804.499  ops/s
ByteBufferBenchmark.benchmark_byte_buffer_put  10000  thrpt  200 
183489.418 ±   1355.967  ops/s


With Changes

Benchmark                                        (L)   Mode  Cnt Score  
Error  Units  Impact
ByteBufferBenchmark.benchmark_byte_buffer_put      1  thrpt  200 
15230086.695 ± 390174.190  ops/s  -48.681%
ByteBufferBenchmark.benchmark_byte_buffer_put     10  thrpt  200 
8126310.728 ± 123661.342  ops/s  -55.399%
ByteBufferBenchmark.benchmark_byte_buffer_put    100  thrpt  200 
1582699.233 ±   7278.744  ops/s  -79.624%
ByteBufferBenchmark.benchmark_byte_buffer_put   1000  thrpt  200 
179726.465 ±    802.333  ops/s  -89.082%
ByteBufferBenchmark.benchmark_byte_buffer_put  10000  thrpt  200 18327.049 
±      9.506  ops/s  -90.012%



NB : For reference - for this and previous benchmarking results ...

"Without Changes" and "With Changes" - java -version ...

openjdk version "10-internal" 2018-03-20
OpenJDK Runtime Environment (build 10-internal+0-adhoc.walshbp.jdk)
OpenJDK 64-Bit Server VM (build 10-internal+0-adhoc.walshbp.jdk, mixed 
mode)


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


Regards,
Ben Walsh




From:   Ben Walsh/UK/IBM
To:     Paul Sandoz <paul.sandoz at oracle.com>
Cc:     core-libs-dev <core-libs-dev at openjdk.java.net>
Date:   05/02/2018 16:47
Subject:        Re: [PATCH] Reduce Chance Of Mistakenly Early Backing 
Memory Cleanup


Running with the following test under the JMH benchmark framework (never 
used this before, so please do point out any issues with the test) ...

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

package org.sample;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;

import java.nio.ByteBuffer;

public class ByteBufferBenchmark {

    @State(Scope.Benchmark)
    public static class ByteBufferContainer {

        ByteBuffer bb;

        @Setup(Level.Invocation)
        public void initByteBuffer() {
            bb = ByteBuffer.allocateDirect(1);
        }

        ByteBuffer getByteBuffer() {
            return bb;
        }
    }

    @Benchmark
    public void benchmark_byte_buffer_put(ByteBufferContainer bbC) {
 
        bbC.getByteBuffer().put((byte)42);
    }

}

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

... I get the following results with and without the changes ...

[9walsbp at dolphin ~]$ ./build_with/jdk/bin/java -jar benchmarks.jar 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils 
(file:/home/9walsbp/benchmarks.jar) to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of 
org.openjdk.jmh.util.Utils
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
# JMH version: 1.20
# VM version: JDK 10-internal, VM 10-internal+0-adhoc.walshbp.jdk
# VM invoker: /home/9walsbp/build_with/jdk/bin/java
# VM options: <none>
# Warmup: 20 iterations, 1 s each
# Measurement: 20 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: org.sample.ByteBufferBenchmark.benchmark_byte_buffer_put

# Run progress: 0.00% complete, ETA 00:06:40
# Fork: 1 of 10
# Warmup Iteration   1: 28572294.700 ops/s
# Warmup Iteration   2: 33102015.934 ops/s
# Warmup Iteration   3: 32883031.968 ops/s
# Warmup Iteration   4: 32875302.586 ops/s
# Warmup Iteration   5: 33708018.941 ops/s
# Warmup Iteration   6: 34107603.885 ops/s
# Warmup Iteration   7: 31615123.362 ops/s
# Warmup Iteration   8: 34306874.876 ops/s
# Warmup Iteration   9: 32615070.232 ops/s
# Warmup Iteration  10: 34268641.323 ops/s
# Warmup Iteration  11: 32209257.766 ops/s
# Warmup Iteration  12: 34111408.999 ops/s
# Warmup Iteration  13: 33527360.187 ops/s
# Warmup Iteration  14: 34331726.136 ops/s
# Warmup Iteration  15: 34325119.218 ops/s
# Warmup Iteration  16: 31562168.904 ops/s
# Warmup Iteration  17: 33227878.358 ops/s
# Warmup Iteration  18: 34151154.273 ops/s
# Warmup Iteration  19: 29264381.793 ops/s
# Warmup Iteration  20: 30308058.560 ops/s
Iteration   1: 33502237.659 ops/s
Iteration   2: 33591469.068 ops/s
Iteration   3: 29330487.674 ops/s
Iteration   4: 31401627.173 ops/s
Iteration   5: 32346391.980 ops/s
Iteration   6: 34106932.868 ops/s
Iteration   7: 29961218.721 ops/s
Iteration   8: 31166503.731 ops/s
Iteration   9: 34180826.531 ops/s
Iteration  10: 34436432.202 ops/s
Iteration  11: 28003272.167 ops/s
Iteration  12: 30947688.218 ops/s
Iteration  13: 33727404.696 ops/s
Iteration  14: 33794727.241 ops/s
Iteration  15: 34089932.945 ops/s
Iteration  16: 30229615.627 ops/s
Iteration  17: 32747950.250 ops/s
Iteration  18: 34195332.494 ops/s
Iteration  19: 34225966.793 ops/s
Iteration  20: 30253949.366 ops/s

# Run progress: 10.00% complete, ETA 00:27:45
# Fork: 2 of 10
# Warmup Iteration   1: 28189458.524 ops/s
# Warmup Iteration   2: 33385943.637 ops/s
# Warmup Iteration   3: 31474459.740 ops/s
# Warmup Iteration   4: 32994555.969 ops/s
# Warmup Iteration   5: 33580210.619 ops/s
# Warmup Iteration   6: 34030937.323 ops/s
# Warmup Iteration   7: 31891882.950 ops/s
# Warmup Iteration   8: 34277935.152 ops/s
# Warmup Iteration   9: 31636968.061 ops/s
# Warmup Iteration  10: 34376216.983 ops/s
# Warmup Iteration  11: 31790184.297 ops/s
# Warmup Iteration  12: 34069806.835 ops/s
# Warmup Iteration  13: 31737398.413 ops/s
# Warmup Iteration  14: 34450863.223 ops/s
# Warmup Iteration  15: 34568522.458 ops/s
# Warmup Iteration  16: 30029081.882 ops/s
# Warmup Iteration  17: 32092783.620 ops/s
# Warmup Iteration  18: 33063366.197 ops/s
# Warmup Iteration  19: 27694130.000 ops/s
# Warmup Iteration  20: 31264525.792 ops/s
Iteration   1: 33330874.247 ops/s
Iteration   2: 34150690.011 ops/s
Iteration   3: 28497705.592 ops/s
Iteration   4: 31877639.021 ops/s
Iteration   5: 33367324.280 ops/s
Iteration   6: 34472176.807 ops/s
Iteration   7: 29032738.714 ops/s
Iteration   8: 31544864.097 ops/s
Iteration   9: 33752028.095 ops/s
Iteration  10: 34473732.353 ops/s
Iteration  11: 29982974.569 ops/s
Iteration  12: 30603336.272 ops/s
Iteration  13: 32481117.249 ops/s
Iteration  14: 33393570.191 ops/s
Iteration  15: 34358979.713 ops/s
Iteration  16: 27617909.839 ops/s
Iteration  17: 30833802.394 ops/s
Iteration  18: 32004461.408 ops/s
Iteration  19: 34074910.495 ops/s
Iteration  20: 34346053.320 ops/s

# Run progress: 20.00% complete, ETA 00:24:26
# Fork: 3 of 10
# Warmup Iteration   1: 28503366.982 ops/s
# Warmup Iteration   2: 33475519.627 ops/s
# Warmup Iteration   3: 34588321.205 ops/s
# Warmup Iteration   4: 35947256.417 ops/s
# Warmup Iteration   5: 37638512.766 ops/s
# Warmup Iteration   6: 38208797.422 ops/s
# Warmup Iteration   7: 32824617.800 ops/s
# Warmup Iteration   8: 35767442.077 ops/s
# Warmup Iteration   9: 36548126.754 ops/s
# Warmup Iteration  10: 38337143.976 ops/s
# Warmup Iteration  11: 35379051.550 ops/s
# Warmup Iteration  12: 38381933.847 ops/s
# Warmup Iteration  13: 36543582.434 ops/s
# Warmup Iteration  14: 38178008.316 ops/s
# Warmup Iteration  15: 38213974.988 ops/s
# Warmup Iteration  16: 32176964.179 ops/s
# Warmup Iteration  17: 35487842.133 ops/s
# Warmup Iteration  18: 38381350.345 ops/s
# Warmup Iteration  19: 31504263.357 ops/s
# Warmup Iteration  20: 37831665.793 ops/s
Iteration   1: 37530637.288 ops/s
Iteration   2: 38628685.180 ops/s
Iteration   3: 35170239.750 ops/s
Iteration   4: 32397535.287 ops/s
Iteration   5: 38643366.565 ops/s
Iteration   6: 35723555.410 ops/s
Iteration   7: 37073023.139 ops/s
Iteration   8: 38332509.859 ops/s
Iteration   9: 36047299.714 ops/s
Iteration  10: 38666580.432 ops/s
Iteration  11: 38827527.980 ops/s
Iteration  12: 38885170.177 ops/s
Iteration  13: 38552899.367 ops/s
Iteration  14: 38231144.659 ops/s
Iteration  15: 26785494.819 ops/s
Iteration  16: 35979289.874 ops/s
Iteration  17: 36233311.409 ops/s
Iteration  18: 37322531.784 ops/s
Iteration  19: 30917505.079 ops/s
Iteration  20: 36602131.217 ops/s

# Run progress: 30.00% complete, ETA 00:19:56
# Fork: 4 of 10
# Warmup Iteration   1: 28201486.347 ops/s
# Warmup Iteration   2: 33954913.216 ops/s
# Warmup Iteration   3: 33614818.543 ops/s
# Warmup Iteration   4: 36075462.255 ops/s
# Warmup Iteration   5: 35868466.813 ops/s
# Warmup Iteration   6: 37539151.611 ops/s
# Warmup Iteration   7: 35791698.290 ops/s
# Warmup Iteration   8: 37804228.841 ops/s
# Warmup Iteration   9: 36209952.096 ops/s
# Warmup Iteration  10: 37995654.523 ops/s
# Warmup Iteration  11: 36279556.807 ops/s
# Warmup Iteration  12: 37876471.909 ops/s
# Warmup Iteration  13: 35472820.096 ops/s
# Warmup Iteration  14: 38192862.745 ops/s
# Warmup Iteration  15: 38214750.954 ops/s
# Warmup Iteration  16: 33616490.113 ops/s
# Warmup Iteration  17: 37147216.192 ops/s
# Warmup Iteration  18: 37759898.719 ops/s
# Warmup Iteration  19: 31762576.627 ops/s
# Warmup Iteration  20: 35935371.693 ops/s
Iteration   1: 37612237.054 ops/s
Iteration   2: 31182849.622 ops/s
Iteration   3: 35771979.960 ops/s
Iteration   4: 37617025.341 ops/s
Iteration   5: 31274273.020 ops/s
Iteration   6: 36798699.672 ops/s
Iteration   7: 37923256.148 ops/s
Iteration   8: 38143822.112 ops/s
Iteration   9: 29781444.210 ops/s
Iteration  10: 34202436.254 ops/s
Iteration  11: 36538073.378 ops/s
Iteration  12: 37944072.150 ops/s
Iteration  13: 30172512.287 ops/s
Iteration  14: 34294490.289 ops/s
Iteration  15: 37096818.141 ops/s
Iteration  16: 37884541.579 ops/s
Iteration  17: 31627891.962 ops/s
Iteration  18: 34458196.904 ops/s
Iteration  19: 37949147.371 ops/s
Iteration  20: 38084720.812 ops/s

# Run progress: 40.00% complete, ETA 00:17:39
# Fork: 5 of 10
# Warmup Iteration   1: 26430556.314 ops/s
# Warmup Iteration   2: 28702874.225 ops/s
# Warmup Iteration   3: 28012568.331 ops/s
# Warmup Iteration   4: 30857741.012 ops/s
# Warmup Iteration   5: 30671764.934 ops/s
# Warmup Iteration   6: 31729981.637 ops/s
# Warmup Iteration   7: 30171277.707 ops/s
# Warmup Iteration   8: 29817290.663 ops/s
# Warmup Iteration   9: 31275042.135 ops/s
# Warmup Iteration  10: 32028867.062 ops/s
# Warmup Iteration  11: 30066034.279 ops/s
# Warmup Iteration  12: 30772389.223 ops/s
# Warmup Iteration  13: 30066233.182 ops/s
# Warmup Iteration  14: 32035909.235 ops/s
# Warmup Iteration  15: 32192119.140 ops/s
# Warmup Iteration  16: 30496387.577 ops/s
# Warmup Iteration  17: 30957378.046 ops/s
# Warmup Iteration  18: 31420314.443 ops/s
# Warmup Iteration  19: 31981518.074 ops/s
# Warmup Iteration  20: 26748312.384 ops/s
Iteration   1: 28740606.592 ops/s
Iteration   2: 30156532.719 ops/s
Iteration   3: 31775304.195 ops/s
Iteration   4: 26843600.302 ops/s
Iteration   5: 30284709.884 ops/s
Iteration   6: 32124615.948 ops/s
Iteration   7: 32123075.530 ops/s
Iteration   8: 26454319.079 ops/s
Iteration   9: 31913402.742 ops/s
Iteration  10: 32437412.737 ops/s
Iteration  11: 32164716.512 ops/s
Iteration  12: 25373082.559 ops/s
Iteration  13: 30293078.502 ops/s
Iteration  14: 31128369.793 ops/s
Iteration  15: 31415561.253 ops/s
Iteration  16: 32120636.468 ops/s
Iteration  17: 25984394.598 ops/s
Iteration  18: 30199573.863 ops/s
Iteration  19: 32556187.120 ops/s
Iteration  20: 32636129.190 ops/s

# Run progress: 50.00% complete, ETA 00:14:30
# Fork: 6 of 10
# Warmup Iteration   1: 28150411.806 ops/s
# Warmup Iteration   2: 28054601.733 ops/s
# Warmup Iteration   3: 33178455.042 ops/s
# Warmup Iteration   4: 33339230.141 ops/s
# Warmup Iteration   5: 33332791.104 ops/s
# Warmup Iteration   6: 33624536.190 ops/s
# Warmup Iteration   7: 31299303.684 ops/s
# Warmup Iteration   8: 33037261.267 ops/s
# Warmup Iteration   9: 33356211.045 ops/s
# Warmup Iteration  10: 33861930.201 ops/s
# Warmup Iteration  11: 33270425.776 ops/s
# Warmup Iteration  12: 33692415.570 ops/s
# Warmup Iteration  13: 33297727.491 ops/s
# Warmup Iteration  14: 33820015.956 ops/s
# Warmup Iteration  15: 33808521.564 ops/s
# Warmup Iteration  16: 31213861.694 ops/s
# Warmup Iteration  17: 32149452.446 ops/s
# Warmup Iteration  18: 33684868.956 ops/s
# Warmup Iteration  19: 30155197.410 ops/s
# Warmup Iteration  20: 33566808.050 ops/s
Iteration   1: 33654501.647 ops/s
Iteration   2: 29509826.671 ops/s
Iteration   3: 29610518.398 ops/s
Iteration   4: 32646220.404 ops/s
Iteration   5: 33773773.299 ops/s
Iteration   6: 27873055.802 ops/s
Iteration   7: 30681259.230 ops/s
Iteration   8: 32717634.647 ops/s
Iteration   9: 33758469.696 ops/s
Iteration  10: 27232349.464 ops/s
Iteration  11: 30616039.535 ops/s
Iteration  12: 31682354.340 ops/s
Iteration  13: 32580910.390 ops/s
Iteration  14: 33811388.262 ops/s
Iteration  15: 27191817.186 ops/s
Iteration  16: 29873209.932 ops/s
Iteration  17: 32087557.824 ops/s
Iteration  18: 32644007.761 ops/s
Iteration  19: 33799135.934 ops/s
Iteration  20: 26758101.989 ops/s

# Run progress: 60.00% complete, ETA 00:11:43
# Fork: 7 of 10
# Warmup Iteration   1: 26592644.866 ops/s
# Warmup Iteration   2: 33131524.362 ops/s
# Warmup Iteration   3: 30127771.163 ops/s
# Warmup Iteration   4: 31924144.092 ops/s
# Warmup Iteration   5: 32001599.069 ops/s
# Warmup Iteration   6: 33648812.429 ops/s
# Warmup Iteration   7: 30874748.951 ops/s
# Warmup Iteration   8: 33802650.338 ops/s
# Warmup Iteration   9: 31054184.796 ops/s
# Warmup Iteration  10: 33484369.763 ops/s
# Warmup Iteration  11: 32834442.289 ops/s
# Warmup Iteration  12: 34217782.915 ops/s
# Warmup Iteration  13: 33036828.248 ops/s
# Warmup Iteration  14: 34368855.165 ops/s
# Warmup Iteration  15: 34415523.035 ops/s
# Warmup Iteration  16: 31187588.079 ops/s
# Warmup Iteration  17: 32594818.974 ops/s
# Warmup Iteration  18: 34086802.016 ops/s
# Warmup Iteration  19: 34340272.384 ops/s
# Warmup Iteration  20: 28259357.798 ops/s
Iteration   1: 31757196.070 ops/s
Iteration   2: 33991747.455 ops/s
Iteration   3: 34024018.852 ops/s
Iteration   4: 33996716.542 ops/s
Iteration   5: 29979159.027 ops/s
Iteration   6: 34012243.975 ops/s
Iteration   7: 33990813.479 ops/s
Iteration   8: 34083707.765 ops/s
Iteration   9: 34107629.820 ops/s
Iteration  10: 27896785.113 ops/s
Iteration  11: 30772172.806 ops/s
Iteration  12: 33765139.270 ops/s
Iteration  13: 34369680.171 ops/s
Iteration  14: 34465158.746 ops/s
Iteration  15: 28118201.187 ops/s
Iteration  16: 30669149.170 ops/s
Iteration  17: 32676396.546 ops/s
Iteration  18: 34190840.882 ops/s
Iteration  19: 34238377.372 ops/s
Iteration  20: 27737131.008 ops/s

# Run progress: 70.00% complete, ETA 00:08:38
# Fork: 8 of 10
# Warmup Iteration   1: 28630824.119 ops/s
# Warmup Iteration   2: 33818762.541 ops/s
# Warmup Iteration   3: 35038007.951 ops/s
# Warmup Iteration   4: 36304928.826 ops/s
# Warmup Iteration   5: 36354056.932 ops/s
# Warmup Iteration   6: 37772679.687 ops/s
# Warmup Iteration   7: 35227674.534 ops/s
# Warmup Iteration   8: 38029506.671 ops/s
# Warmup Iteration   9: 34585248.627 ops/s
# Warmup Iteration  10: 37248219.973 ops/s
# Warmup Iteration  11: 34593434.702 ops/s
# Warmup Iteration  12: 35464181.287 ops/s
# Warmup Iteration  13: 36696009.835 ops/s
# Warmup Iteration  14: 38316197.354 ops/s
# Warmup Iteration  15: 38266037.386 ops/s
# Warmup Iteration  16: 37189662.171 ops/s
# Warmup Iteration  17: 36523113.799 ops/s
# Warmup Iteration  18: 37988022.876 ops/s
# Warmup Iteration  19: 38051736.146 ops/s
# Warmup Iteration  20: 31182088.185 ops/s
Iteration   1: 37190441.731 ops/s
Iteration   2: 37956882.826 ops/s
Iteration   3: 38140733.603 ops/s
Iteration   4: 37252516.227 ops/s
Iteration   5: 31725393.553 ops/s
Iteration   6: 36471814.199 ops/s
Iteration   7: 38114054.355 ops/s
Iteration   8: 32616409.003 ops/s
Iteration   9: 37786024.918 ops/s
Iteration  10: 37992346.638 ops/s
Iteration  11: 38123237.062 ops/s
Iteration  12: 38287723.965 ops/s
Iteration  13: 38345880.203 ops/s
Iteration  14: 31130022.209 ops/s
Iteration  15: 37986966.666 ops/s
Iteration  16: 36960266.429 ops/s
Iteration  17: 38008103.179 ops/s
Iteration  18: 38014088.784 ops/s
Iteration  19: 38110627.648 ops/s
Iteration  20: 38072572.537 ops/s

# Run progress: 80.00% complete, ETA 00:05:39
# Fork: 9 of 10
# Warmup Iteration   1: 28298513.112 ops/s
# Warmup Iteration   2: 32838632.035 ops/s
# Warmup Iteration   3: 30181316.633 ops/s
# Warmup Iteration   4: 32909381.568 ops/s
# Warmup Iteration   5: 31944847.556 ops/s
# Warmup Iteration   6: 33397277.722 ops/s
# Warmup Iteration   7: 30750924.273 ops/s
# Warmup Iteration   8: 33913172.836 ops/s
# Warmup Iteration   9: 31744562.260 ops/s
# Warmup Iteration  10: 33605243.253 ops/s
# Warmup Iteration  11: 31510842.700 ops/s
# Warmup Iteration  12: 33828656.623 ops/s
# Warmup Iteration  13: 31525600.401 ops/s
# Warmup Iteration  14: 34036366.024 ops/s
# Warmup Iteration  15: 34031912.703 ops/s
# Warmup Iteration  16: 29092574.272 ops/s
# Warmup Iteration  17: 32539488.819 ops/s
# Warmup Iteration  18: 32600231.822 ops/s
# Warmup Iteration  19: 32928686.312 ops/s
# Warmup Iteration  20: 33536586.546 ops/s
Iteration   1: 30083475.241 ops/s
Iteration   2: 32341395.220 ops/s
Iteration   3: 33803703.325 ops/s
Iteration   4: 33915545.687 ops/s
Iteration   5: 30320419.165 ops/s
Iteration   6: 33472727.881 ops/s
Iteration   7: 33757353.957 ops/s
Iteration   8: 28339704.610 ops/s
Iteration   9: 33045545.359 ops/s
Iteration  10: 33815271.934 ops/s
Iteration  11: 33793968.698 ops/s
Iteration  12: 33715714.353 ops/s
Iteration  13: 33979632.042 ops/s
Iteration  14: 29129416.976 ops/s
Iteration  15: 32352103.774 ops/s
Iteration  16: 32349089.070 ops/s
Iteration  17: 32198286.479 ops/s
Iteration  18: 29763083.673 ops/s
Iteration  19: 30985401.866 ops/s
Iteration  20: 30704515.609 ops/s

# Run progress: 90.00% complete, ETA 00:02:45
# Fork: 10 of 10
# Warmup Iteration   1: 25845863.121 ops/s
# Warmup Iteration   2: 33218974.229 ops/s
# Warmup Iteration   3: 32576422.877 ops/s
# Warmup Iteration   4: 33624698.333 ops/s
# Warmup Iteration   5: 32881377.229 ops/s
# Warmup Iteration   6: 33675931.296 ops/s
# Warmup Iteration   7: 31678171.139 ops/s
# Warmup Iteration   8: 31865457.116 ops/s
# Warmup Iteration   9: 32035721.100 ops/s
# Warmup Iteration  10: 33759626.899 ops/s
# Warmup Iteration  11: 32020679.489 ops/s
# Warmup Iteration  12: 33497805.239 ops/s
# Warmup Iteration  13: 31818025.906 ops/s
# Warmup Iteration  14: 34086770.330 ops/s
# Warmup Iteration  15: 34168967.286 ops/s
# Warmup Iteration  16: 28807710.513 ops/s
# Warmup Iteration  17: 31152856.399 ops/s
# Warmup Iteration  18: 33772983.915 ops/s
# Warmup Iteration  19: 34020496.828 ops/s
# Warmup Iteration  20: 28814678.720 ops/s
Iteration   1: 31022028.693 ops/s
Iteration   2: 33609915.911 ops/s
Iteration   3: 32123372.543 ops/s
Iteration   4: 27813625.332 ops/s
Iteration   5: 31379592.611 ops/s
Iteration   6: 32644747.339 ops/s
Iteration   7: 33793411.987 ops/s
Iteration   8: 30422277.460 ops/s
Iteration   9: 32626659.385 ops/s
Iteration  10: 33719480.304 ops/s
Iteration  11: 33980011.600 ops/s
Iteration  12: 28107750.520 ops/s
Iteration  13: 31126083.092 ops/s
Iteration  14: 32649007.164 ops/s
Iteration  15: 33744248.267 ops/s
Iteration  16: 34026461.866 ops/s
Iteration  17: 27717690.095 ops/s
Iteration  18: 31491088.409 ops/s
Iteration  19: 32894429.409 ops/s
Iteration  20: 33722538.163 ops/s


Result "org.sample.ByteBufferBenchmark.benchmark_byte_buffer_put":
  33100911.857 ±(99.9%) 747461.951 ops/s [Average]
  (min, avg, max) = (25373082.559, 33100911.857, 38885170.177), stdev = 
3164800.705
  CI (99.9%): [32353449.906, 33848373.808] (assumes normal distribution)


# Run complete. Total time: 00:27:27

Benchmark                                       Mode  Cnt         Score   
Error  Units
ByteBufferBenchmark.benchmark_byte_buffer_put  thrpt  200  33100911.857 ± 
747461.951  ops/s



[9walsbp at dolphin ~]$ ./build_without/jdk/bin/java -jar benchmarks.jar 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils 
(file:/home/9walsbp/benchmarks.jar) to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of 
org.openjdk.jmh.util.Utils
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
# JMH version: 1.20
# VM version: JDK 10-internal, VM 10-internal+0-adhoc.walshbp.jdk
# VM invoker: /home/9walsbp/build_without/jdk/bin/java
# VM options: <none>
# Warmup: 20 iterations, 1 s each
# Measurement: 20 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: org.sample.ByteBufferBenchmark.benchmark_byte_buffer_put

# Run progress: 0.00% complete, ETA 00:06:40
# Fork: 1 of 10
# Warmup Iteration   1: 29113219.200 ops/s
# Warmup Iteration   2: 38390854.347 ops/s
# Warmup Iteration   3: 37576196.805 ops/s
# Warmup Iteration   4: 38517882.972 ops/s
# Warmup Iteration   5: 38838678.528 ops/s
# Warmup Iteration   6: 38722019.753 ops/s
# Warmup Iteration   7: 30279515.339 ops/s
# Warmup Iteration   8: 37301591.985 ops/s
# Warmup Iteration   9: 38937014.242 ops/s
# Warmup Iteration  10: 38446665.693 ops/s
# Warmup Iteration  11: 35988668.446 ops/s
# Warmup Iteration  12: 37681609.419 ops/s
# Warmup Iteration  13: 38993187.956 ops/s
# Warmup Iteration  14: 37414379.929 ops/s
# Warmup Iteration  15: 38753712.247 ops/s
# Warmup Iteration  16: 38753551.189 ops/s
# Warmup Iteration  17: 33767765.399 ops/s
# Warmup Iteration  18: 37450537.087 ops/s
# Warmup Iteration  19: 39118737.402 ops/s
# Warmup Iteration  20: 39031101.838 ops/s
Iteration   1: 32912027.168 ops/s
Iteration   2: 37597695.079 ops/s
Iteration   3: 37116802.899 ops/s
Iteration   4: 37425452.741 ops/s
Iteration   5: 31759009.838 ops/s
Iteration   6: 37428294.033 ops/s
Iteration   7: 38607838.742 ops/s
Iteration   8: 34858025.193 ops/s
Iteration   9: 36273653.347 ops/s
Iteration  10: 38886985.073 ops/s
Iteration  11: 38684265.699 ops/s
Iteration  12: 30418949.886 ops/s
Iteration  13: 36510488.388 ops/s
Iteration  14: 37732064.835 ops/s
Iteration  15: 37907332.810 ops/s
Iteration  16: 38640267.003 ops/s
Iteration  17: 31545863.662 ops/s
Iteration  18: 36326351.514 ops/s
Iteration  19: 37504107.281 ops/s
Iteration  20: 36925861.540 ops/s

# Run progress: 10.00% complete, ETA 00:23:50
# Fork: 2 of 10
# Warmup Iteration   1: 31027078.683 ops/s
# Warmup Iteration   2: 32638372.801 ops/s
# Warmup Iteration   3: 32343711.957 ops/s
# Warmup Iteration   4: 33981414.940 ops/s
# Warmup Iteration   5: 34883411.692 ops/s
# Warmup Iteration   6: 35725521.918 ops/s
# Warmup Iteration   7: 33357134.144 ops/s
# Warmup Iteration   8: 33753068.420 ops/s
# Warmup Iteration   9: 35403231.692 ops/s
# Warmup Iteration  10: 35235976.314 ops/s
# Warmup Iteration  11: 35321898.883 ops/s
# Warmup Iteration  12: 34820537.854 ops/s
# Warmup Iteration  13: 35920876.086 ops/s
# Warmup Iteration  14: 35251249.967 ops/s
# Warmup Iteration  15: 34446183.776 ops/s
# Warmup Iteration  16: 33048031.622 ops/s
# Warmup Iteration  17: 31531379.814 ops/s
# Warmup Iteration  18: 33034792.981 ops/s
# Warmup Iteration  19: 34738150.009 ops/s
# Warmup Iteration  20: 30077393.793 ops/s
Iteration   1: 31766138.031 ops/s
Iteration   2: 32851639.920 ops/s
Iteration   3: 33660705.695 ops/s
Iteration   4: 30490177.412 ops/s
Iteration   5: 33922213.740 ops/s
Iteration   6: 35233366.402 ops/s
Iteration   7: 35626761.045 ops/s
Iteration   8: 30340609.672 ops/s
Iteration   9: 34019673.519 ops/s
Iteration  10: 36014726.921 ops/s
Iteration  11: 35974210.612 ops/s
Iteration  12: 30201358.306 ops/s
Iteration  13: 31810853.163 ops/s
Iteration  14: 33132733.085 ops/s
Iteration  15: 34555927.009 ops/s
Iteration  16: 35932316.359 ops/s
Iteration  17: 29234047.193 ops/s
Iteration  18: 33989744.306 ops/s
Iteration  19: 33949712.258 ops/s
Iteration  20: 35135848.150 ops/s

# Run progress: 20.00% complete, ETA 00:21:55
# Fork: 3 of 10
# Warmup Iteration   1: 30980353.496 ops/s
# Warmup Iteration   2: 32972554.880 ops/s
# Warmup Iteration   3: 33057281.401 ops/s
# Warmup Iteration   4: 34633426.034 ops/s
# Warmup Iteration   5: 34517376.033 ops/s
# Warmup Iteration   6: 35702523.091 ops/s
# Warmup Iteration   7: 34365724.187 ops/s
# Warmup Iteration   8: 36032644.388 ops/s
# Warmup Iteration   9: 35136119.559 ops/s
# Warmup Iteration  10: 36140189.976 ops/s
# Warmup Iteration  11: 33882357.986 ops/s
# Warmup Iteration  12: 35778782.987 ops/s
# Warmup Iteration  13: 33902794.405 ops/s
# Warmup Iteration  14: 36155738.838 ops/s
# Warmup Iteration  15: 36206714.982 ops/s
# Warmup Iteration  16: 32084735.481 ops/s
# Warmup Iteration  17: 34564731.167 ops/s
# Warmup Iteration  18: 35168148.516 ops/s
# Warmup Iteration  19: 30421286.177 ops/s
# Warmup Iteration  20: 31997040.084 ops/s
Iteration   1: 35802127.743 ops/s
Iteration   2: 30223432.040 ops/s
Iteration   3: 33523343.257 ops/s
Iteration   4: 35660309.083 ops/s
Iteration   5: 35997090.209 ops/s
Iteration   6: 31239191.252 ops/s
Iteration   7: 36147747.729 ops/s
Iteration   8: 36147969.988 ops/s
Iteration   9: 36208488.301 ops/s
Iteration  10: 29792833.489 ops/s
Iteration  11: 34580451.949 ops/s
Iteration  12: 36064305.066 ops/s
Iteration  13: 36041893.088 ops/s
Iteration  14: 35855446.086 ops/s
Iteration  15: 31661873.490 ops/s
Iteration  16: 35036383.811 ops/s
Iteration  17: 35857209.919 ops/s
Iteration  18: 36029402.370 ops/s
Iteration  19: 35930595.692 ops/s
Iteration  20: 31699203.984 ops/s

# Run progress: 30.00% complete, ETA 00:19:36
# Fork: 4 of 10
# Warmup Iteration   1: 31296595.515 ops/s
# Warmup Iteration   2: 37908633.020 ops/s
# Warmup Iteration   3: 35250565.078 ops/s
# Warmup Iteration   4: 37752285.871 ops/s
# Warmup Iteration   5: 37914294.026 ops/s
# Warmup Iteration   6: 38377635.946 ops/s
# Warmup Iteration   7: 32733864.039 ops/s
# Warmup Iteration   8: 38064547.309 ops/s
# Warmup Iteration   9: 36544704.445 ops/s
# Warmup Iteration  10: 33882227.479 ops/s
# Warmup Iteration  11: 36836752.434 ops/s
# Warmup Iteration  12: 38446392.157 ops/s
# Warmup Iteration  13: 36364073.955 ops/s
# Warmup Iteration  14: 38706702.104 ops/s
# Warmup Iteration  15: 38652050.082 ops/s
# Warmup Iteration  16: 34322809.290 ops/s
# Warmup Iteration  17: 37700500.798 ops/s
# Warmup Iteration  18: 38906944.697 ops/s
# Warmup Iteration  19: 33195845.787 ops/s
# Warmup Iteration  20: 35821942.775 ops/s
Iteration   1: 39417175.657 ops/s
Iteration   2: 39325998.402 ops/s
Iteration   3: 39056076.106 ops/s
Iteration   4: 32921279.546 ops/s
Iteration   5: 39054221.339 ops/s
Iteration   6: 36515839.874 ops/s
Iteration   7: 32172960.935 ops/s
Iteration   8: 37976219.446 ops/s
Iteration   9: 38929526.685 ops/s
Iteration  10: 38894878.237 ops/s
Iteration  11: 31978400.534 ops/s
Iteration  12: 36903626.167 ops/s
Iteration  13: 39131870.806 ops/s
Iteration  14: 39345626.043 ops/s
Iteration  15: 39026205.926 ops/s
Iteration  16: 36806664.950 ops/s
Iteration  17: 38630575.119 ops/s
Iteration  18: 37854064.857 ops/s
Iteration  19: 39440319.418 ops/s
Iteration  20: 39524804.534 ops/s

# Run progress: 40.00% complete, ETA 00:16:54
# Fork: 5 of 10
# Warmup Iteration   1: 31110038.023 ops/s
# Warmup Iteration   2: 34412040.058 ops/s
# Warmup Iteration   3: 31235963.893 ops/s
# Warmup Iteration   4: 30767353.395 ops/s
# Warmup Iteration   5: 34439323.107 ops/s
# Warmup Iteration   6: 36266948.529 ops/s
# Warmup Iteration   7: 36055758.564 ops/s
# Warmup Iteration   8: 34585869.673 ops/s
# Warmup Iteration   9: 36567490.492 ops/s
# Warmup Iteration  10: 35504554.003 ops/s
# Warmup Iteration  11: 36179962.205 ops/s
# Warmup Iteration  12: 32394762.264 ops/s
# Warmup Iteration  13: 35653335.954 ops/s
# Warmup Iteration  14: 35620586.786 ops/s
# Warmup Iteration  15: 35863809.190 ops/s
# Warmup Iteration  16: 36259837.483 ops/s
# Warmup Iteration  17: 36302387.266 ops/s
# Warmup Iteration  18: 33192738.788 ops/s
# Warmup Iteration  19: 36523702.645 ops/s
# Warmup Iteration  20: 36629186.036 ops/s
Iteration   1: 36694296.125 ops/s
Iteration   2: 36680567.770 ops/s
Iteration   3: 36495812.469 ops/s
Iteration   4: 32343259.943 ops/s
Iteration   5: 33671386.030 ops/s
Iteration   6: 35555005.646 ops/s
Iteration   7: 35211358.656 ops/s
Iteration   8: 36081526.871 ops/s
Iteration   9: 36107058.585 ops/s
Iteration  10: 32729883.053 ops/s
Iteration  11: 35724907.378 ops/s
Iteration  12: 36499143.866 ops/s
Iteration  13: 36603461.237 ops/s
Iteration  14: 36631899.844 ops/s
Iteration  15: 36121361.065 ops/s
Iteration  16: 33671874.478 ops/s
Iteration  17: 36083864.464 ops/s
Iteration  18: 36667481.469 ops/s
Iteration  19: 36722951.627 ops/s
Iteration  20: 36566197.534 ops/s

# Run progress: 50.00% complete, ETA 00:13:22
# Fork: 6 of 10
# Warmup Iteration   1: 31029872.095 ops/s
# Warmup Iteration   2: 37230506.713 ops/s
# Warmup Iteration   3: 38809151.616 ops/s
# Warmup Iteration   4: 38329927.142 ops/s
# Warmup Iteration   5: 38143210.031 ops/s
# Warmup Iteration   6: 38809118.052 ops/s
# Warmup Iteration   7: 33967885.816 ops/s
# Warmup Iteration   8: 38749239.488 ops/s
# Warmup Iteration   9: 38579178.021 ops/s
# Warmup Iteration  10: 36703103.973 ops/s
# Warmup Iteration  11: 38954258.462 ops/s
# Warmup Iteration  12: 39112773.031 ops/s
# Warmup Iteration  13: 38741746.259 ops/s
# Warmup Iteration  14: 39076601.751 ops/s
# Warmup Iteration  15: 38986191.092 ops/s
# Warmup Iteration  16: 37138531.823 ops/s
# Warmup Iteration  17: 37857790.291 ops/s
# Warmup Iteration  18: 38843053.603 ops/s
# Warmup Iteration  19: 38787113.306 ops/s
# Warmup Iteration  20: 35306823.192 ops/s
Iteration   1: 37055062.962 ops/s
Iteration   2: 38855425.772 ops/s
Iteration   3: 35013411.175 ops/s
Iteration   4: 35274085.229 ops/s
Iteration   5: 38493671.894 ops/s
Iteration   6: 36760520.168 ops/s
Iteration   7: 37653602.024 ops/s
Iteration   8: 37387676.588 ops/s
Iteration   9: 38555022.030 ops/s
Iteration  10: 28687868.812 ops/s
Iteration  11: 27046401.908 ops/s
Iteration  12: 29259494.625 ops/s
Iteration  13: 26667525.465 ops/s
Iteration  14: 25558172.378 ops/s
Iteration  15: 35911579.186 ops/s
Iteration  16: 36880307.369 ops/s
Iteration  17: 38333722.473 ops/s
Iteration  18: 34790538.914 ops/s
Iteration  19: 36686520.151 ops/s
Iteration  20: 37382730.439 ops/s

# Run progress: 60.00% complete, ETA 00:10:48
# Fork: 7 of 10
# Warmup Iteration   1: 31057306.449 ops/s
# Warmup Iteration   2: 35840428.213 ops/s
# Warmup Iteration   3: 34143557.080 ops/s
# Warmup Iteration   4: 36667927.955 ops/s
# Warmup Iteration   5: 36452958.037 ops/s
# Warmup Iteration   6: 38232808.327 ops/s
# Warmup Iteration   7: 35551071.320 ops/s
# Warmup Iteration   8: 38541440.865 ops/s
# Warmup Iteration   9: 36172684.586 ops/s
# Warmup Iteration  10: 38633066.168 ops/s
# Warmup Iteration  11: 36349123.423 ops/s
# Warmup Iteration  12: 38523683.054 ops/s
# Warmup Iteration  13: 36124569.851 ops/s
# Warmup Iteration  14: 38950543.533 ops/s
# Warmup Iteration  15: 38869447.272 ops/s
# Warmup Iteration  16: 31093331.577 ops/s
# Warmup Iteration  17: 37392337.846 ops/s
# Warmup Iteration  18: 39057287.494 ops/s
# Warmup Iteration  19: 38995112.909 ops/s
# Warmup Iteration  20: 39066421.796 ops/s
Iteration   1: 32127004.028 ops/s
Iteration   2: 37499140.095 ops/s
Iteration   3: 36539432.705 ops/s
Iteration   4: 33907894.925 ops/s
Iteration   5: 38054763.625 ops/s
Iteration   6: 38733118.320 ops/s
Iteration   7: 38622694.446 ops/s
Iteration   8: 32751376.012 ops/s
Iteration   9: 35019544.916 ops/s
Iteration  10: 38858825.000 ops/s
Iteration  11: 38910765.208 ops/s
Iteration  12: 31043691.167 ops/s
Iteration  13: 35840369.231 ops/s
Iteration  14: 37385724.264 ops/s
Iteration  15: 39023580.476 ops/s
Iteration  16: 38741774.638 ops/s
Iteration  17: 31542116.877 ops/s
Iteration  18: 34719270.004 ops/s
Iteration  19: 38908161.679 ops/s
Iteration  20: 38963054.209 ops/s

# Run progress: 70.00% complete, ETA 00:08:05
# Fork: 8 of 10
# Warmup Iteration   1: 30003148.195 ops/s
# Warmup Iteration   2: 35462032.545 ops/s
# Warmup Iteration   3: 33071571.604 ops/s
# Warmup Iteration   4: 35387917.187 ops/s
# Warmup Iteration   5: 34586963.687 ops/s
# Warmup Iteration   6: 35448683.915 ops/s
# Warmup Iteration   7: 32807613.797 ops/s
# Warmup Iteration   8: 35915731.511 ops/s
# Warmup Iteration   9: 33149556.434 ops/s
# Warmup Iteration  10: 35195706.499 ops/s
# Warmup Iteration  11: 33596358.520 ops/s
# Warmup Iteration  12: 35353239.403 ops/s
# Warmup Iteration  13: 33508839.669 ops/s
# Warmup Iteration  14: 35930589.401 ops/s
# Warmup Iteration  15: 35941526.705 ops/s
# Warmup Iteration  16: 30714684.903 ops/s
# Warmup Iteration  17: 32933652.946 ops/s
# Warmup Iteration  18: 34942977.718 ops/s
# Warmup Iteration  19: 35976691.542 ops/s
# Warmup Iteration  20: 30498957.215 ops/s
Iteration   1: 35631149.027 ops/s
Iteration   2: 36122657.348 ops/s
Iteration   3: 29257602.641 ops/s
Iteration   4: 31964437.318 ops/s
Iteration   5: 35123171.218 ops/s
Iteration   6: 35988762.826 ops/s
Iteration   7: 33333800.776 ops/s
Iteration   8: 33839869.951 ops/s
Iteration   9: 35877741.832 ops/s
Iteration  10: 35977710.893 ops/s
Iteration  11: 35928268.472 ops/s
Iteration  12: 31871331.622 ops/s
Iteration  13: 33520435.719 ops/s
Iteration  14: 35271300.135 ops/s
Iteration  15: 36042505.102 ops/s
Iteration  16: 36026785.491 ops/s
Iteration  17: 29606290.243 ops/s
Iteration  18: 34555390.595 ops/s
Iteration  19: 35040209.776 ops/s
Iteration  20: 35526038.193 ops/s

# Run progress: 80.00% complete, ETA 00:05:25
# Fork: 9 of 10
# Warmup Iteration   1: 30780286.932 ops/s
# Warmup Iteration   2: 38554787.285 ops/s
# Warmup Iteration   3: 35499729.607 ops/s
# Warmup Iteration   4: 38123652.259 ops/s
# Warmup Iteration   5: 38287045.843 ops/s
# Warmup Iteration   6: 38909349.390 ops/s
# Warmup Iteration   7: 34160614.025 ops/s
# Warmup Iteration   8: 36714969.322 ops/s
# Warmup Iteration   9: 35724081.900 ops/s
# Warmup Iteration  10: 34344266.878 ops/s
# Warmup Iteration  11: 36691467.403 ops/s
# Warmup Iteration  12: 38395178.914 ops/s
# Warmup Iteration  13: 37303043.548 ops/s
# Warmup Iteration  14: 39117495.343 ops/s
# Warmup Iteration  15: 38410409.515 ops/s
# Warmup Iteration  16: 36557299.657 ops/s
# Warmup Iteration  17: 39137443.252 ops/s
# Warmup Iteration  18: 38967960.625 ops/s
# Warmup Iteration  19: 34626900.596 ops/s
# Warmup Iteration  20: 37683007.712 ops/s
Iteration   1: 39077842.127 ops/s
Iteration   2: 34347095.059 ops/s
Iteration   3: 37355881.353 ops/s
Iteration   4: 39049529.112 ops/s
Iteration   5: 34227298.880 ops/s
Iteration   6: 34912978.620 ops/s
Iteration   7: 36002838.823 ops/s
Iteration   8: 39311390.901 ops/s
Iteration   9: 33107477.135 ops/s
Iteration  10: 37288472.263 ops/s
Iteration  11: 36867078.249 ops/s
Iteration  12: 38982164.040 ops/s
Iteration  13: 33384786.397 ops/s
Iteration  14: 35745764.678 ops/s
Iteration  15: 36567956.300 ops/s
Iteration  16: 38434831.820 ops/s
Iteration  17: 38847394.679 ops/s
Iteration  18: 34190903.091 ops/s
Iteration  19: 36003870.959 ops/s
Iteration  20: 36590393.071 ops/s

# Run progress: 90.00% complete, ETA 00:02:44
# Fork: 10 of 10
# Warmup Iteration   1: 28889703.379 ops/s
# Warmup Iteration   2: 38603492.577 ops/s
# Warmup Iteration   3: 34043794.352 ops/s
# Warmup Iteration   4: 37985769.911 ops/s
# Warmup Iteration   5: 37337263.671 ops/s
# Warmup Iteration   6: 38294358.387 ops/s
# Warmup Iteration   7: 33591758.046 ops/s
# Warmup Iteration   8: 35677991.195 ops/s
# Warmup Iteration   9: 35626708.813 ops/s
# Warmup Iteration  10: 35001658.546 ops/s
# Warmup Iteration  11: 34895453.027 ops/s
# Warmup Iteration  12: 38305387.208 ops/s
# Warmup Iteration  13: 31137358.688 ops/s
# Warmup Iteration  14: 38642485.864 ops/s
# Warmup Iteration  15: 38586100.872 ops/s
# Warmup Iteration  16: 35486297.661 ops/s
# Warmup Iteration  17: 38936456.857 ops/s
# Warmup Iteration  18: 38776288.591 ops/s
# Warmup Iteration  19: 38495102.028 ops/s
# Warmup Iteration  20: 34583854.305 ops/s
Iteration   1: 35593487.267 ops/s
Iteration   2: 36719438.475 ops/s
Iteration   3: 33895023.416 ops/s
Iteration   4: 34812011.249 ops/s
Iteration   5: 38906937.001 ops/s
Iteration   6: 38182707.915 ops/s
Iteration   7: 35294815.634 ops/s
Iteration   8: 37426940.293 ops/s
Iteration   9: 37385447.731 ops/s
Iteration  10: 38628608.563 ops/s
Iteration  11: 34323084.222 ops/s
Iteration  12: 35285335.362 ops/s
Iteration  13: 36995943.696 ops/s
Iteration  14: 38944858.911 ops/s
Iteration  15: 38516334.356 ops/s
Iteration  16: 34389934.288 ops/s
Iteration  17: 35448198.837 ops/s
Iteration  18: 38375706.441 ops/s
Iteration  19: 38841034.693 ops/s
Iteration  20: 38600776.337 ops/s


Result "org.sample.ByteBufferBenchmark.benchmark_byte_buffer_put":
  35604933.518 ±(99.9%) 654975.515 ops/s [Average]
  (min, avg, max) = (25558172.378, 35604933.518, 39524804.534), stdev = 
2773207.341
  CI (99.9%): [34949958.003, 36259909.033] (assumes normal distribution)


# Run complete. Total time: 00:27:51

Benchmark                                       Mode  Cnt         Score   
Error  Units
ByteBufferBenchmark.benchmark_byte_buffer_put  thrpt  200  35604933.518 ± 
654975.515  ops/s


... So a performance degradation of roughly 7%.


Regards,
Ben Walsh






From:   Paul Sandoz <paul.sandoz at oracle.com>
To:     Ben Walsh <ben_walsh at uk.ibm.com>
Cc:     core-libs-dev <core-libs-dev at openjdk.java.net>
Date:   01/02/2018 22:50
Subject:        Re: [PATCH] Reduce Chance Of Mistakenly Early Backing 
Memory Cleanup



Hi Ben,

I don?t think you require the fence in all the cases you have currently 
placed it e.g. here for example

        $memtype$ y = $toBits$(x);
        UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
+        Reference.reachabilityFence(this);
        return this;

since ?this? is being returned it will be kept live during the unsafe 
access.

Would you mind providing a JMH benchmark and results for the performance 
with and without the fence for say a put and/or a get. I would like to 
understand the performance impact on HotSpot, this is one reason why we 
have yet to add such fences as it will likely impact performance. 

At the moment we are relying on the method not being inlined, which is an 
expedient technique to make it functional and keep a reference alive but 
not necessarily optimal for usages in DBB.

For more details see:

  https://bugs.openjdk.java.net/browse/JDK-8169605
  https://bugs.openjdk.java.net/browse/JDK-8149610

Thanks,
Paul.

On Feb 1, 2018, at 6:55 AM, Ben Walsh <ben_walsh at uk.ibm.com> wrote:

This contribution forms a partial solution to the problem detailed here - 
http://thevirtualmachinist.blogspot.ca/2011/07/subtle-issue-of-reachability.html

.

In this context, this contribution provides "markers" such that a suitably 

"aware" compiler can reduce the chances of such a problem occurring with 
each of the Direct<Type>Buffer<RW><BO> objects and MappedByteBuffer 
object. The reachabilityFences may prevent crashes / exceptions due to 
cleaning up the backing memory before the user has finished using the 
pointer. 

Any compiler not suitably "aware" could be modified to make use of the 
"markers".


I would like to pair with a sponsor to contribute this patch ...

-------------------------------------------------------------------------------------------------------------------
diff -r d51e64840b4f 
src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
--- 
a/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template 
Wed Jan 31 12:04:53 2018 +0800
+++ 
b/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template 
Thu Feb 01 11:30:10 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights 
reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights 
reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -33,15 +33,21 @@

    private $type$ get$Type$(long a) {
        $memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
-        return $fromBits$(x);
+        $type$ y = $fromBits$(x);
+        Reference.reachabilityFence(this);
+        return y;
    }

    public $type$ get$Type$() {
-        return get$Type$(ix(nextGetIndex($BYTES_PER_VALUE$)));
+        $type$ y = get$Type$(ix(nextGetIndex($BYTES_PER_VALUE$)));
+        Reference.reachabilityFence(this);
+        return y;
    }

    public $type$ get$Type$(int i) {
-        return get$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)));
+        $type$ y = get$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)));
+        Reference.reachabilityFence(this);
+        return y;
    }

#end[rw]
@@ -50,6 +56,7 @@
#if[rw]
        $memtype$ y = $toBits$(x);
        UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
+        Reference.reachabilityFence(this);
        return this;
#else[rw]
        throw new ReadOnlyBufferException();
diff -r d51e64840b4f 
src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template 
Wed Jan 31 12:04:53 2018 +0800
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template 
Thu Feb 01 11:30:10 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights 
reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights 
reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
package java.nio;

import java.io.FileDescriptor;
+import java.lang.ref.Reference;
import jdk.internal.misc.VM;
import jdk.internal.ref.Cleaner;
import sun.nio.ch.DirectBuffer;
@@ -312,6 +313,7 @@
    public $Type$Buffer put($type$ x) {
#if[rw]
        UNSAFE.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
+        Reference.reachabilityFence(this);
        return this;
#else[rw]
        throw new ReadOnlyBufferException();
@@ -321,6 +323,7 @@
    public $Type$Buffer put(int i, $type$ x) {
#if[rw]
        UNSAFE.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
+        Reference.reachabilityFence(this);
        return this;
#else[rw]
        throw new ReadOnlyBufferException();
@@ -347,6 +350,7 @@
            if (srem > rem)
                throw new BufferOverflowException();
            UNSAFE.copyMemory(sb.ix(spos), ix(pos), (long)srem << 
$LG_BYTES_PER_VALUE$);
+            Reference.reachabilityFence(this);
            sb.position(spos + srem);
            position(pos + srem);
        } else if (src.hb != null) {
@@ -413,6 +417,7 @@
        int rem = (pos <= lim ? lim - pos : 0);

        UNSAFE.copyMemory(ix(pos), ix(0), (long)rem << 
$LG_BYTES_PER_VALUE$);
+        Reference.reachabilityFence(this);
        position(rem);
        limit(capacity());
        discardMark();
@@ -505,6 +510,7 @@
    void _put(int i, byte b) {                  // package-private
#if[rw]
        UNSAFE.putByte(address + i, b);
+        Reference.reachabilityFence(this);
#else[rw]
        throw new ReadOnlyBufferException();
#end[rw]
diff -r d51e64840b4f 
src/java.base/share/classes/java/nio/MappedByteBuffer.java
--- a/src/java.base/share/classes/java/nio/MappedByteBuffer.java Wed Jan 
31 12:04:53 2018 +0800
+++ b/src/java.base/share/classes/java/nio/MappedByteBuffer.java Thu Feb 
01 11:30:10 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights 
reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights 
reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package java.nio;

import java.io.FileDescriptor;
+import java.lang.ref.Reference;
import jdk.internal.misc.Unsafe;


@@ -164,6 +165,7 @@
        // is computed as we go along to prevent the compiler from 
otherwise
        // considering the loop as dead code.
        Unsafe unsafe = Unsafe.getUnsafe();
+        Reference.reachabilityFence(this);
        int ps = Bits.pageSize();
        int count = Bits.pageCount(length);
        long a = mappingAddress(offset);
-------------------------------------------------------------------------------------------------------------------


Regards,
Ben Walsh


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



More information about the core-libs-dev mailing list