Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for rendering to InputStreamRockerOutput #93

Closed
Serranya opened this issue Dec 13, 2018 · 10 comments · Fixed by #94
Closed

Implement support for rendering to InputStreamRockerOutput #93

Serranya opened this issue Dec 13, 2018 · 10 comments · Fixed by #94

Comments

@Serranya
Copy link
Contributor

Hello everyone,

I use rocker to render "into" an InputStream which can be consumed later. I would like to have this feature included in the offical rocker distribution to make reuse simpler and share with the community.

@jjlauer
Copy link
Member

jjlauer commented Dec 13, 2018

Hey @Serranya -- not sure I understand the feature. You want to "write" data to an InputStream? It sounds like you really want to write data to a buffer or a PipeOutputStream (which lets you then read it back somewhere else). I'd say Rocker's current OutputStreamRockerOutput handles both. You can either just write the template to a ByteArrayOutputStream or use a PipeOutputStream which you could connect back to an PipeInputStream. Or maybe there's something else I'm missing with your question.

@Serranya
Copy link
Contributor Author

Hi @jjlauer

I know that the feature can be pretty easily implement with an PipedOutputStream or an ByteArrayOutputStream.

I did this in a few projects of mine. But instead of repeating myself over and over again I thought that my implementation could maybe get accepted into the rocker runtime. So I don't have to repeat myself in my porjects and maybe someone else gets something out of this.

@jjlauer
Copy link
Member

jjlauer commented Dec 13, 2018

Gotcha. Did you ever try the https://github.com/fizzed/rocker/blob/master/rocker-runtime/src/main/java/com/fizzed/rocker/runtime/ArrayOfByteArraysOutput.java method? I'm not sure of the performance vs. a ByteArrayOutputStream, but that has a toByteArray() method and some ability to provide a byte channel as well. You could just add a method to that called "toInputStream" that returns a byte array input stream that wraps the toByteArray() result.

@Serranya
Copy link
Contributor Author

I did not compare performance.

I did not use the ArrayOfByteArrayOutput because it looked like its not very fast when lot of String writes occur. The javadoc also states that its faster for byte[] writes.

But this is all speculation. Maybe I can write up a test I have no experience with performance testing yet.

@Serranya
Copy link
Contributor Author

Ok,

I did some initial benchmarking. You can find the source here: https://github.com/Serranya/rocker-benchmark/blob/master/src/main/java/org/sample/MyBenchmark.java

Seems like the ArrayOfByteArrayOutput is faster. This is the short result

Benchmark                      (numberStrings)  (stringLength)  Mode  Cnt       Score      Error  Units
MyBenchmark.arrayOfByteArrays              100              50  avgt   15      41,114 ±    1,055  us/op
MyBenchmark.arrayOfByteArrays              100             500  avgt   15     356,393 ±   12,372  us/op
MyBenchmark.arrayOfByteArrays              100            5000  avgt   15    3604,313 ±  147,758  us/op
MyBenchmark.arrayOfByteArrays             1000              50  avgt   15     454,269 ±   11,500  us/op
MyBenchmark.arrayOfByteArrays             1000             500  avgt   15    3854,090 ±   89,434  us/op
MyBenchmark.arrayOfByteArrays             1000            5000  avgt   15   35418,747 ±  914,007  us/op
MyBenchmark.arrayOfByteArrays            10000              50  avgt   15    4699,386 ±  179,792  us/op
MyBenchmark.arrayOfByteArrays            10000             500  avgt   15   37693,202 ±  338,053  us/op
MyBenchmark.arrayOfByteArrays            10000            5000  avgt   15  374780,519 ± 6977,959  us/op
MyBenchmark.inputStream                    100              50  avgt   15      42,868 ±    0,825  us/op
MyBenchmark.inputStream                    100             500  avgt   15     377,458 ±    6,444  us/op
MyBenchmark.inputStream                    100            5000  avgt   15    3736,556 ±   45,051  us/op
MyBenchmark.inputStream                   1000              50  avgt   15     450,259 ±    9,863  us/op
MyBenchmark.inputStream                   1000             500  avgt   15    3868,485 ±   85,223  us/op
MyBenchmark.inputStream                   1000            5000  avgt   15   39474,876 ± 1023,145  us/op
MyBenchmark.inputStream                  10000              50  avgt   15    4962,622 ±  104,886  us/op
MyBenchmark.inputStream                  10000             500  avgt   15   43457,516 ±  877,389  us/op
MyBenchmark.inputStream                  10000            5000  avgt   15  468735,402 ± 8793,146  us/op

Long result:

# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 100, stringLength = 50)

# Run progress: 0,00% complete, ETA 00:45:00
# Fork: 1 of 5
# Warmup Iteration   1: 42,922 us/op
# Warmup Iteration   2: 41,717 us/op
# Warmup Iteration   3: 41,685 us/op
Iteration   1: 41,404 us/op
Iteration   2: 42,087 us/op
Iteration   3: 41,861 us/op

# Run progress: 1,11% complete, ETA 00:45:20
# Fork: 2 of 5
# Warmup Iteration   1: 41,495 us/op
# Warmup Iteration   2: 38,767 us/op
# Warmup Iteration   3: 38,377 us/op
Iteration   1: 39,412 us/op
Iteration   2: 39,904 us/op
Iteration   3: 41,908 us/op

# Run progress: 2,22% complete, ETA 00:44:41
# Fork: 3 of 5
# Warmup Iteration   1: 41,611 us/op
# Warmup Iteration   2: 39,434 us/op
# Warmup Iteration   3: 39,848 us/op
Iteration   1: 40,412 us/op
Iteration   2: 40,887 us/op
Iteration   3: 39,922 us/op

# Run progress: 3,33% complete, ETA 00:44:07
# Fork: 4 of 5
# Warmup Iteration   1: 41,999 us/op
# Warmup Iteration   2: 41,253 us/op
# Warmup Iteration   3: 42,128 us/op
Iteration   1: 42,223 us/op
Iteration   2: 41,686 us/op
Iteration   3: 40,127 us/op

# Run progress: 4,44% complete, ETA 00:43:35
# Fork: 5 of 5
# Warmup Iteration   1: 43,143 us/op
# Warmup Iteration   2: 40,720 us/op
# Warmup Iteration   3: 41,421 us/op
Iteration   1: 41,689 us/op
Iteration   2: 40,656 us/op
Iteration   3: 42,535 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  41,114 ±(99.9%) 1,055 us/op [Average]
  (min, avg, max) = (39,412, 41,114, 42,535), stdev = 0,987
  CI (99.9%): [40,059, 42,169] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 100, stringLength = 500)

# Run progress: 5,56% complete, ETA 00:43:04
# Fork: 1 of 5
# Warmup Iteration   1: 366,455 us/op
# Warmup Iteration   2: 357,280 us/op
# Warmup Iteration   3: 351,420 us/op
Iteration   1: 346,792 us/op
Iteration   2: 346,446 us/op
Iteration   3: 346,875 us/op

# Run progress: 6,67% complete, ETA 00:42:34
# Fork: 2 of 5
# Warmup Iteration   1: 367,792 us/op
# Warmup Iteration   2: 356,905 us/op
# Warmup Iteration   3: 347,170 us/op
Iteration   1: 351,784 us/op
Iteration   2: 364,738 us/op
Iteration   3: 354,968 us/op

# Run progress: 7,78% complete, ETA 00:42:04
# Fork: 3 of 5
# Warmup Iteration   1: 384,030 us/op
# Warmup Iteration   2: 375,258 us/op
# Warmup Iteration   3: 374,197 us/op
Iteration   1: 369,650 us/op
Iteration   2: 369,840 us/op
Iteration   3: 384,056 us/op

# Run progress: 8,89% complete, ETA 00:41:33
# Fork: 4 of 5
# Warmup Iteration   1: 353,365 us/op
# Warmup Iteration   2: 350,060 us/op
# Warmup Iteration   3: 349,978 us/op
Iteration   1: 347,699 us/op
Iteration   2: 344,868 us/op
Iteration   3: 344,620 us/op

# Run progress: 10,00% complete, ETA 00:41:02
# Fork: 5 of 5
# Warmup Iteration   1: 360,917 us/op
# Warmup Iteration   2: 360,894 us/op
# Warmup Iteration   3: 360,589 us/op
Iteration   1: 360,840 us/op
Iteration   2: 353,926 us/op
Iteration   3: 358,795 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  356,393 ±(99.9%) 12,372 us/op [Average]
  (min, avg, max) = (344,620, 356,393, 384,056), stdev = 11,573
  CI (99.9%): [344,021, 368,766] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 100, stringLength = 5000)

# Run progress: 11,11% complete, ETA 00:40:32
# Fork: 1 of 5
# Warmup Iteration   1: 3606,361 us/op
# Warmup Iteration   2: 3754,870 us/op
# Warmup Iteration   3: 3774,849 us/op
Iteration   1: 3964,627 us/op
Iteration   2: 3877,089 us/op
Iteration   3: 3546,776 us/op

# Run progress: 12,22% complete, ETA 00:40:01
# Fork: 2 of 5
# Warmup Iteration   1: 3545,484 us/op
# Warmup Iteration   2: 3506,641 us/op
# Warmup Iteration   3: 3501,244 us/op
Iteration   1: 3525,751 us/op
Iteration   2: 3596,058 us/op
Iteration   3: 3567,062 us/op

# Run progress: 13,33% complete, ETA 00:39:31
# Fork: 3 of 5
# Warmup Iteration   1: 3597,805 us/op
# Warmup Iteration   2: 3533,954 us/op
# Warmup Iteration   3: 3513,116 us/op
Iteration   1: 3578,678 us/op
Iteration   2: 3616,923 us/op
Iteration   3: 3568,170 us/op

# Run progress: 14,44% complete, ETA 00:39:01
# Fork: 4 of 5
# Warmup Iteration   1: 3539,057 us/op
# Warmup Iteration   2: 3473,767 us/op
# Warmup Iteration   3: 3420,600 us/op
Iteration   1: 3488,013 us/op
Iteration   2: 3570,187 us/op
Iteration   3: 3454,698 us/op

# Run progress: 15,56% complete, ETA 00:38:30
# Fork: 5 of 5
# Warmup Iteration   1: 3484,211 us/op
# Warmup Iteration   2: 3459,185 us/op
# Warmup Iteration   3: 3540,931 us/op
Iteration   1: 3520,706 us/op
Iteration   2: 3540,641 us/op
Iteration   3: 3649,315 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  3604,313 ±(99.9%) 147,758 us/op [Average]
  (min, avg, max) = (3454,698, 3604,313, 3964,627), stdev = 138,213
  CI (99.9%): [3456,555, 3752,071] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 1000, stringLength = 50)

# Run progress: 16,67% complete, ETA 00:38:00
# Fork: 1 of 5
# Warmup Iteration   1: 483,939 us/op
# Warmup Iteration   2: 461,478 us/op
# Warmup Iteration   3: 450,034 us/op
Iteration   1: 473,671 us/op
Iteration   2: 466,156 us/op
Iteration   3: 466,865 us/op

# Run progress: 17,78% complete, ETA 00:37:29
# Fork: 2 of 5
# Warmup Iteration   1: 463,289 us/op
# Warmup Iteration   2: 441,410 us/op
# Warmup Iteration   3: 438,674 us/op
Iteration   1: 443,150 us/op
Iteration   2: 438,864 us/op
Iteration   3: 448,937 us/op

# Run progress: 18,89% complete, ETA 00:36:59
# Fork: 3 of 5
# Warmup Iteration   1: 477,273 us/op
# Warmup Iteration   2: 461,293 us/op
# Warmup Iteration   3: 453,890 us/op
Iteration   1: 454,421 us/op
Iteration   2: 457,666 us/op
Iteration   3: 470,246 us/op

# Run progress: 20,00% complete, ETA 00:36:28
# Fork: 4 of 5
# Warmup Iteration   1: 465,652 us/op
# Warmup Iteration   2: 450,409 us/op
# Warmup Iteration   3: 443,138 us/op
Iteration   1: 450,143 us/op
Iteration   2: 439,433 us/op
Iteration   3: 449,897 us/op

# Run progress: 21,11% complete, ETA 00:35:58
# Fork: 5 of 5
# Warmup Iteration   1: 462,402 us/op
# Warmup Iteration   2: 446,314 us/op
# Warmup Iteration   3: 452,007 us/op
Iteration   1: 453,761 us/op
Iteration   2: 449,631 us/op
Iteration   3: 451,193 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  454,269 ±(99.9%) 11,500 us/op [Average]
  (min, avg, max) = (438,864, 454,269, 473,671), stdev = 10,757
  CI (99.9%): [442,769, 465,769] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 1000, stringLength = 500)

# Run progress: 22,22% complete, ETA 00:35:27
# Fork: 1 of 5
# Warmup Iteration   1: 4036,342 us/op
# Warmup Iteration   2: 3905,432 us/op
# Warmup Iteration   3: 3864,210 us/op
Iteration   1: 3885,244 us/op
Iteration   2: 3870,178 us/op
Iteration   3: 3933,173 us/op

# Run progress: 23,33% complete, ETA 00:34:57
# Fork: 2 of 5
# Warmup Iteration   1: 3914,910 us/op
# Warmup Iteration   2: 3805,768 us/op
# Warmup Iteration   3: 3791,153 us/op
Iteration   1: 3921,037 us/op
Iteration   2: 3868,394 us/op
Iteration   3: 3787,686 us/op

# Run progress: 24,44% complete, ETA 00:34:26
# Fork: 3 of 5
# Warmup Iteration   1: 3849,333 us/op
# Warmup Iteration   2: 3845,355 us/op
# Warmup Iteration   3: 3800,257 us/op
Iteration   1: 3958,974 us/op
Iteration   2: 3800,679 us/op
Iteration   3: 3872,502 us/op

# Run progress: 25,56% complete, ETA 00:33:56
# Fork: 4 of 5
# Warmup Iteration   1: 3854,051 us/op
# Warmup Iteration   2: 3767,941 us/op
# Warmup Iteration   3: 3785,956 us/op
Iteration   1: 3868,724 us/op
Iteration   2: 3802,174 us/op
Iteration   3: 3778,510 us/op

# Run progress: 26,67% complete, ETA 00:33:26
# Fork: 5 of 5
# Warmup Iteration   1: 3840,750 us/op
# Warmup Iteration   2: 3653,743 us/op
# Warmup Iteration   3: 3631,966 us/op
Iteration   1: 3691,169 us/op
Iteration   2: 3764,089 us/op
Iteration   3: 4008,821 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  3854,090 ±(99.9%) 89,434 us/op [Average]
  (min, avg, max) = (3691,169, 3854,090, 4008,821), stdev = 83,657
  CI (99.9%): [3764,656, 3943,524] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 1000, stringLength = 5000)

# Run progress: 27,78% complete, ETA 00:32:55
# Fork: 1 of 5
# Warmup Iteration   1: 37793,763 us/op
# Warmup Iteration   2: 35698,854 us/op
# Warmup Iteration   3: 35380,106 us/op
Iteration   1: 35287,030 us/op
Iteration   2: 35336,941 us/op
Iteration   3: 35017,339 us/op

# Run progress: 28,89% complete, ETA 00:32:25
# Fork: 2 of 5
# Warmup Iteration   1: 37131,567 us/op
# Warmup Iteration   2: 35496,393 us/op
# Warmup Iteration   3: 35308,496 us/op
Iteration   1: 35326,000 us/op
Iteration   2: 35445,628 us/op
Iteration   3: 35409,711 us/op

# Run progress: 30,00% complete, ETA 00:31:55
# Fork: 3 of 5
# Warmup Iteration   1: 36194,192 us/op
# Warmup Iteration   2: 34894,310 us/op
# Warmup Iteration   3: 34594,151 us/op
Iteration   1: 34732,551 us/op
Iteration   2: 34652,369 us/op
Iteration   3: 34497,006 us/op

# Run progress: 31,11% complete, ETA 00:31:25
# Fork: 4 of 5
# Warmup Iteration   1: 36557,541 us/op
# Warmup Iteration   2: 35626,444 us/op
# Warmup Iteration   3: 36161,037 us/op
Iteration   1: 36647,877 us/op
Iteration   2: 37092,929 us/op
Iteration   3: 37129,445 us/op

# Run progress: 32,22% complete, ETA 00:30:55
# Fork: 5 of 5
# Warmup Iteration   1: 36254,922 us/op
# Warmup Iteration   2: 36547,973 us/op
# Warmup Iteration   3: 35334,740 us/op
Iteration   1: 35007,036 us/op
Iteration   2: 35041,663 us/op
Iteration   3: 34657,674 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  35418,747 ±(99.9%) 914,007 us/op [Average]
  (min, avg, max) = (34497,006, 35418,747, 37129,445), stdev = 854,962
  CI (99.9%): [34504,740, 36332,753] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 10000, stringLength = 50)

# Run progress: 33,33% complete, ETA 00:30:25
# Fork: 1 of 5
# Warmup Iteration   1: 4567,192 us/op
# Warmup Iteration   2: 4448,299 us/op
# Warmup Iteration   3: 4590,755 us/op
Iteration   1: 4523,398 us/op
Iteration   2: 4489,326 us/op
Iteration   3: 4633,704 us/op

# Run progress: 34,44% complete, ETA 00:29:54
# Fork: 2 of 5
# Warmup Iteration   1: 4705,989 us/op
# Warmup Iteration   2: 4537,945 us/op
# Warmup Iteration   3: 4562,636 us/op
Iteration   1: 4513,794 us/op
Iteration   2: 4605,287 us/op
Iteration   3: 4621,662 us/op

# Run progress: 35,56% complete, ETA 00:29:24
# Fork: 3 of 5
# Warmup Iteration   1: 4737,144 us/op
# Warmup Iteration   2: 4682,492 us/op
# Warmup Iteration   3: 4684,204 us/op
Iteration   1: 4469,535 us/op
Iteration   2: 4742,570 us/op
Iteration   3: 4730,623 us/op

# Run progress: 36,67% complete, ETA 00:28:53
# Fork: 4 of 5
# Warmup Iteration   1: 4957,385 us/op
# Warmup Iteration   2: 4784,851 us/op
# Warmup Iteration   3: 4826,714 us/op
Iteration   1: 4755,365 us/op
Iteration   2: 4826,027 us/op
Iteration   3: 4858,090 us/op

# Run progress: 37,78% complete, ETA 00:28:23
# Fork: 5 of 5
# Warmup Iteration   1: 4947,454 us/op
# Warmup Iteration   2: 4761,800 us/op
# Warmup Iteration   3: 4757,432 us/op
Iteration   1: 4789,630 us/op
Iteration   2: 5058,073 us/op
Iteration   3: 4873,711 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  4699,386 ±(99.9%) 179,792 us/op [Average]
  (min, avg, max) = (4469,535, 4699,386, 5058,073), stdev = 168,177
  CI (99.9%): [4519,594, 4879,178] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 10000, stringLength = 500)

# Run progress: 38,89% complete, ETA 00:27:52
# Fork: 1 of 5
# Warmup Iteration   1: 39702,115 us/op
# Warmup Iteration   2: 37680,745 us/op
# Warmup Iteration   3: 37739,224 us/op
Iteration   1: 37417,552 us/op
Iteration   2: 37529,361 us/op
Iteration   3: 37219,113 us/op

# Run progress: 40,00% complete, ETA 00:27:22
# Fork: 2 of 5
# Warmup Iteration   1: 39726,146 us/op
# Warmup Iteration   2: 38155,096 us/op
# Warmup Iteration   3: 38166,137 us/op
Iteration   1: 37644,679 us/op
Iteration   2: 37780,016 us/op
Iteration   3: 37448,630 us/op

# Run progress: 41,11% complete, ETA 00:26:52
# Fork: 3 of 5
# Warmup Iteration   1: 39393,966 us/op
# Warmup Iteration   2: 36916,063 us/op
# Warmup Iteration   3: 36836,224 us/op
Iteration   1: 37256,508 us/op
Iteration   2: 38102,887 us/op
Iteration   3: 37945,756 us/op

# Run progress: 42,22% complete, ETA 00:26:22
# Fork: 4 of 5
# Warmup Iteration   1: 39587,007 us/op
# Warmup Iteration   2: 38034,519 us/op
# Warmup Iteration   3: 38140,237 us/op
Iteration   1: 37586,129 us/op
Iteration   2: 38265,828 us/op
Iteration   3: 38029,210 us/op

# Run progress: 43,33% complete, ETA 00:25:52
# Fork: 5 of 5
# Warmup Iteration   1: 40233,914 us/op
# Warmup Iteration   2: 37971,074 us/op
# Warmup Iteration   3: 38718,785 us/op
Iteration   1: 37655,973 us/op
Iteration   2: 37515,118 us/op
Iteration   3: 38001,267 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  37693,202 ±(99.9%) 338,053 us/op [Average]
  (min, avg, max) = (37219,113, 37693,202, 38265,828), stdev = 316,215
  CI (99.9%): [37355,149, 38031,255] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.arrayOfByteArrays
# Parameters: (numberStrings = 10000, stringLength = 5000)

# Run progress: 44,44% complete, ETA 00:25:21
# Fork: 1 of 5
# Warmup Iteration   1: 407874,770 us/op
# Warmup Iteration   2: 392763,997 us/op
# Warmup Iteration   3: 377262,331 us/op
Iteration   1: 380483,481 us/op
Iteration   2: 364803,892 us/op
Iteration   3: 380611,514 us/op

# Run progress: 45,56% complete, ETA 00:24:53
# Fork: 2 of 5
# Warmup Iteration   1: 391274,547 us/op
# Warmup Iteration   2: 404007,545 us/op
# Warmup Iteration   3: 369519,197 us/op
Iteration   1: 361352,240 us/op
Iteration   2: 363302,134 us/op
Iteration   3: 381839,926 us/op

# Run progress: 46,67% complete, ETA 00:24:25
# Fork: 3 of 5
# Warmup Iteration   1: 403366,633 us/op
# Warmup Iteration   2: 382992,332 us/op
# Warmup Iteration   3: 364706,404 us/op
Iteration   1: 375419,944 us/op
Iteration   2: 374421,494 us/op
Iteration   3: 374483,287 us/op

# Run progress: 47,78% complete, ETA 00:23:56
# Fork: 4 of 5
# Warmup Iteration   1: 401453,548 us/op
# Warmup Iteration   2: 370552,233 us/op
# Warmup Iteration   3: 372306,402 us/op
Iteration   1: 375596,038 us/op
Iteration   2: 375906,595 us/op
Iteration   3: 375516,862 us/op

# Run progress: 48,89% complete, ETA 00:23:28
# Fork: 5 of 5
# Warmup Iteration   1: 404030,751 us/op
# Warmup Iteration   2: 387374,678 us/op
# Warmup Iteration   3: 400717,040 us/op
Iteration   1: 378949,151 us/op
Iteration   2: 378232,477 us/op
Iteration   3: 380788,757 us/op


Result "org.sample.MyBenchmark.arrayOfByteArrays":
  374780,519 ±(99.9%) 6977,959 us/op [Average]
  (min, avg, max) = (361352,240, 374780,519, 381839,926), stdev = 6527,187
  CI (99.9%): [367802,560, 381758,478] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 100, stringLength = 50)

# Run progress: 50,00% complete, ETA 00:22:59
# Fork: 1 of 5
# Warmup Iteration   1: 44,583 us/op
# Warmup Iteration   2: 42,585 us/op
# Warmup Iteration   3: 42,819 us/op
Iteration   1: 42,917 us/op
Iteration   2: 43,395 us/op
Iteration   3: 42,828 us/op

# Run progress: 51,11% complete, ETA 00:22:28
# Fork: 2 of 5
# Warmup Iteration   1: 45,720 us/op
# Warmup Iteration   2: 43,651 us/op
# Warmup Iteration   3: 44,059 us/op
Iteration   1: 43,709 us/op
Iteration   2: 44,057 us/op
Iteration   3: 43,910 us/op

# Run progress: 52,22% complete, ETA 00:21:57
# Fork: 3 of 5
# Warmup Iteration   1: 43,986 us/op
# Warmup Iteration   2: 41,919 us/op
# Warmup Iteration   3: 41,759 us/op
Iteration   1: 42,015 us/op
Iteration   2: 42,186 us/op
Iteration   3: 41,677 us/op

# Run progress: 53,33% complete, ETA 00:21:26
# Fork: 4 of 5
# Warmup Iteration   1: 42,801 us/op
# Warmup Iteration   2: 41,907 us/op
# Warmup Iteration   3: 43,101 us/op
Iteration   1: 43,106 us/op
Iteration   2: 43,300 us/op
Iteration   3: 42,983 us/op

# Run progress: 54,44% complete, ETA 00:20:56
# Fork: 5 of 5
# Warmup Iteration   1: 43,736 us/op
# Warmup Iteration   2: 41,806 us/op
# Warmup Iteration   3: 42,004 us/op
Iteration   1: 41,883 us/op
Iteration   2: 41,907 us/op
Iteration   3: 43,147 us/op


Result "org.sample.MyBenchmark.inputStream":
  42,868 ±(99.9%) 0,825 us/op [Average]
  (min, avg, max) = (41,677, 42,868, 44,057), stdev = 0,771
  CI (99.9%): [42,043, 43,693] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 100, stringLength = 500)

# Run progress: 55,56% complete, ETA 00:20:25
# Fork: 1 of 5
# Warmup Iteration   1: 378,356 us/op
# Warmup Iteration   2: 383,634 us/op
# Warmup Iteration   3: 382,558 us/op
Iteration   1: 389,680 us/op
Iteration   2: 380,578 us/op
Iteration   3: 373,197 us/op

# Run progress: 56,67% complete, ETA 00:19:54
# Fork: 2 of 5
# Warmup Iteration   1: 384,722 us/op
# Warmup Iteration   2: 372,334 us/op
# Warmup Iteration   3: 363,340 us/op
Iteration   1: 380,641 us/op
Iteration   2: 379,840 us/op
Iteration   3: 374,486 us/op

# Run progress: 57,78% complete, ETA 00:19:23
# Fork: 3 of 5
# Warmup Iteration   1: 396,414 us/op
# Warmup Iteration   2: 387,036 us/op
# Warmup Iteration   3: 380,735 us/op
Iteration   1: 382,981 us/op
Iteration   2: 375,034 us/op
Iteration   3: 382,246 us/op

# Run progress: 58,89% complete, ETA 00:18:52
# Fork: 4 of 5
# Warmup Iteration   1: 371,971 us/op
# Warmup Iteration   2: 373,728 us/op
# Warmup Iteration   3: 378,365 us/op
Iteration   1: 380,474 us/op
Iteration   2: 368,969 us/op
Iteration   3: 365,191 us/op

# Run progress: 60,00% complete, ETA 00:18:22
# Fork: 5 of 5
# Warmup Iteration   1: 392,515 us/op
# Warmup Iteration   2: 380,534 us/op
# Warmup Iteration   3: 401,767 us/op
Iteration   1: 378,828 us/op
Iteration   2: 374,399 us/op
Iteration   3: 375,332 us/op


Result "org.sample.MyBenchmark.inputStream":
  377,458 ±(99.9%) 6,444 us/op [Average]
  (min, avg, max) = (365,191, 377,458, 389,680), stdev = 6,027
  CI (99.9%): [371,015, 383,902] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 100, stringLength = 5000)

# Run progress: 61,11% complete, ETA 00:17:51
# Fork: 1 of 5
# Warmup Iteration   1: 3909,456 us/op
# Warmup Iteration   2: 3773,258 us/op
# Warmup Iteration   3: 3750,326 us/op
Iteration   1: 3784,971 us/op
Iteration   2: 3786,797 us/op
Iteration   3: 3767,950 us/op

# Run progress: 62,22% complete, ETA 00:17:20
# Fork: 2 of 5
# Warmup Iteration   1: 3978,992 us/op
# Warmup Iteration   2: 3709,153 us/op
# Warmup Iteration   3: 3678,668 us/op
Iteration   1: 3742,364 us/op
Iteration   2: 3752,173 us/op
Iteration   3: 3674,965 us/op

# Run progress: 63,33% complete, ETA 00:16:49
# Fork: 3 of 5
# Warmup Iteration   1: 3828,070 us/op
# Warmup Iteration   2: 3697,857 us/op
# Warmup Iteration   3: 3751,410 us/op
Iteration   1: 3648,971 us/op
Iteration   2: 3748,255 us/op
Iteration   3: 3709,801 us/op

# Run progress: 64,44% complete, ETA 00:16:19
# Fork: 4 of 5
# Warmup Iteration   1: 3912,453 us/op
# Warmup Iteration   2: 3737,528 us/op
# Warmup Iteration   3: 3620,978 us/op
Iteration   1: 3695,551 us/op
Iteration   2: 3701,304 us/op
Iteration   3: 3730,119 us/op

# Run progress: 65,56% complete, ETA 00:15:48
# Fork: 5 of 5
# Warmup Iteration   1: 3868,444 us/op
# Warmup Iteration   2: 3649,139 us/op
# Warmup Iteration   3: 3759,617 us/op
Iteration   1: 3757,939 us/op
Iteration   2: 3784,698 us/op
Iteration   3: 3762,487 us/op


Result "org.sample.MyBenchmark.inputStream":
  3736,556 ±(99.9%) 45,051 us/op [Average]
  (min, avg, max) = (3648,971, 3736,556, 3786,797), stdev = 42,141
  CI (99.9%): [3691,505, 3781,607] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 1000, stringLength = 50)

# Run progress: 66,67% complete, ETA 00:15:17
# Fork: 1 of 5
# Warmup Iteration   1: 458,091 us/op
# Warmup Iteration   2: 437,897 us/op
# Warmup Iteration   3: 435,303 us/op
Iteration   1: 434,635 us/op
Iteration   2: 458,073 us/op
Iteration   3: 456,707 us/op

# Run progress: 67,78% complete, ETA 00:14:47
# Fork: 2 of 5
# Warmup Iteration   1: 472,691 us/op
# Warmup Iteration   2: 454,876 us/op
# Warmup Iteration   3: 442,523 us/op
Iteration   1: 436,836 us/op
Iteration   2: 456,343 us/op
Iteration   3: 448,742 us/op

# Run progress: 68,89% complete, ETA 00:14:16
# Fork: 3 of 5
# Warmup Iteration   1: 480,516 us/op
# Warmup Iteration   2: 458,330 us/op
# Warmup Iteration   3: 460,459 us/op
Iteration   1: 460,314 us/op
Iteration   2: 464,397 us/op
Iteration   3: 461,772 us/op

# Run progress: 70,00% complete, ETA 00:13:45
# Fork: 4 of 5
# Warmup Iteration   1: 467,301 us/op
# Warmup Iteration   2: 440,902 us/op
# Warmup Iteration   3: 438,694 us/op
Iteration   1: 444,741 us/op
Iteration   2: 447,881 us/op
Iteration   3: 441,444 us/op

# Run progress: 71,11% complete, ETA 00:13:15
# Fork: 5 of 5
# Warmup Iteration   1: 478,845 us/op
# Warmup Iteration   2: 457,706 us/op
# Warmup Iteration   3: 455,519 us/op
Iteration   1: 441,490 us/op
Iteration   2: 450,996 us/op
Iteration   3: 449,507 us/op


Result "org.sample.MyBenchmark.inputStream":
  450,259 ±(99.9%) 9,863 us/op [Average]
  (min, avg, max) = (434,635, 450,259, 464,397), stdev = 9,226
  CI (99.9%): [440,396, 460,122] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 1000, stringLength = 500)

# Run progress: 72,22% complete, ETA 00:12:44
# Fork: 1 of 5
# Warmup Iteration   1: 4044,371 us/op
# Warmup Iteration   2: 3891,650 us/op
# Warmup Iteration   3: 3838,222 us/op
Iteration   1: 3801,745 us/op
Iteration   2: 3838,519 us/op
Iteration   3: 3806,178 us/op

# Run progress: 73,33% complete, ETA 00:12:13
# Fork: 2 of 5
# Warmup Iteration   1: 4012,741 us/op
# Warmup Iteration   2: 3830,493 us/op
# Warmup Iteration   3: 3860,404 us/op
Iteration   1: 3908,216 us/op
Iteration   2: 3725,334 us/op
Iteration   3: 3839,085 us/op

# Run progress: 74,44% complete, ETA 00:11:43
# Fork: 3 of 5
# Warmup Iteration   1: 4147,694 us/op
# Warmup Iteration   2: 4052,802 us/op
# Warmup Iteration   3: 3872,674 us/op
Iteration   1: 3951,883 us/op
Iteration   2: 3793,517 us/op
Iteration   3: 3840,568 us/op

# Run progress: 75,56% complete, ETA 00:11:12
# Fork: 4 of 5
# Warmup Iteration   1: 4181,297 us/op
# Warmup Iteration   2: 3924,178 us/op
# Warmup Iteration   3: 4002,144 us/op
Iteration   1: 3897,851 us/op
Iteration   2: 3919,685 us/op
Iteration   3: 3839,752 us/op

# Run progress: 76,67% complete, ETA 00:10:41
# Fork: 5 of 5
# Warmup Iteration   1: 4142,267 us/op
# Warmup Iteration   2: 3980,599 us/op
# Warmup Iteration   3: 3945,920 us/op
Iteration   1: 4015,370 us/op
Iteration   2: 3999,685 us/op
Iteration   3: 3849,891 us/op


Result "org.sample.MyBenchmark.inputStream":
  3868,485 ±(99.9%) 85,223 us/op [Average]
  (min, avg, max) = (3725,334, 3868,485, 4015,370), stdev = 79,717
  CI (99.9%): [3783,263, 3953,708] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 1000, stringLength = 5000)

# Run progress: 77,78% complete, ETA 00:10:11
# Fork: 1 of 5
# Warmup Iteration   1: 45246,285 us/op
# Warmup Iteration   2: 43151,937 us/op
# Warmup Iteration   3: 40840,751 us/op
Iteration   1: 40080,354 us/op
Iteration   2: 38399,980 us/op
Iteration   3: 38280,506 us/op

# Run progress: 78,89% complete, ETA 00:09:40
# Fork: 2 of 5
# Warmup Iteration   1: 42207,770 us/op
# Warmup Iteration   2: 41031,325 us/op
# Warmup Iteration   3: 40275,915 us/op
Iteration   1: 41261,971 us/op
Iteration   2: 39216,898 us/op
Iteration   3: 39813,334 us/op

# Run progress: 80,00% complete, ETA 00:09:10
# Fork: 3 of 5
# Warmup Iteration   1: 43111,271 us/op
# Warmup Iteration   2: 39266,893 us/op
# Warmup Iteration   3: 40262,456 us/op
Iteration   1: 40966,565 us/op
Iteration   2: 39628,457 us/op
Iteration   3: 38949,907 us/op

# Run progress: 81,11% complete, ETA 00:08:39
# Fork: 4 of 5
# Warmup Iteration   1: 42990,656 us/op
# Warmup Iteration   2: 41013,025 us/op
# Warmup Iteration   3: 40726,156 us/op
Iteration   1: 40212,093 us/op
Iteration   2: 38138,934 us/op
Iteration   3: 38591,216 us/op

# Run progress: 82,22% complete, ETA 00:08:09
# Fork: 5 of 5
# Warmup Iteration   1: 43299,237 us/op
# Warmup Iteration   2: 44037,801 us/op
# Warmup Iteration   3: 40579,094 us/op
Iteration   1: 40275,733 us/op
Iteration   2: 39056,967 us/op
Iteration   3: 39250,230 us/op


Result "org.sample.MyBenchmark.inputStream":
  39474,876 ±(99.9%) 1023,145 us/op [Average]
  (min, avg, max) = (38138,934, 39474,876, 41261,971), stdev = 957,050
  CI (99.9%): [38451,732, 40498,021] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 10000, stringLength = 50)

# Run progress: 83,33% complete, ETA 00:07:38
# Fork: 1 of 5
# Warmup Iteration   1: 5270,748 us/op
# Warmup Iteration   2: 5074,596 us/op
# Warmup Iteration   3: 5056,677 us/op
Iteration   1: 5085,386 us/op
Iteration   2: 5115,003 us/op
Iteration   3: 4881,634 us/op

# Run progress: 84,44% complete, ETA 00:07:07
# Fork: 2 of 5
# Warmup Iteration   1: 5303,354 us/op
# Warmup Iteration   2: 5063,205 us/op
# Warmup Iteration   3: 4980,950 us/op
Iteration   1: 5032,342 us/op
Iteration   2: 4973,882 us/op
Iteration   3: 4857,516 us/op

# Run progress: 85,56% complete, ETA 00:06:37
# Fork: 3 of 5
# Warmup Iteration   1: 5175,751 us/op
# Warmup Iteration   2: 4932,981 us/op
# Warmup Iteration   3: 4873,701 us/op
Iteration   1: 4918,502 us/op
Iteration   2: 4934,068 us/op
Iteration   3: 4866,396 us/op

# Run progress: 86,67% complete, ETA 00:06:06
# Fork: 4 of 5
# Warmup Iteration   1: 5337,729 us/op
# Warmup Iteration   2: 5054,657 us/op
# Warmup Iteration   3: 5047,288 us/op
Iteration   1: 5051,352 us/op
Iteration   2: 5098,225 us/op
Iteration   3: 5029,689 us/op

# Run progress: 87,78% complete, ETA 00:05:36
# Fork: 5 of 5
# Warmup Iteration   1: 5312,140 us/op
# Warmup Iteration   2: 5087,227 us/op
# Warmup Iteration   3: 5026,353 us/op
Iteration   1: 4885,968 us/op
Iteration   2: 4885,646 us/op
Iteration   3: 4823,722 us/op


Result "org.sample.MyBenchmark.inputStream":
  4962,622 ±(99.9%) 104,886 us/op [Average]
  (min, avg, max) = (4823,722, 4962,622, 5115,003), stdev = 98,111
  CI (99.9%): [4857,736, 5067,508] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 10000, stringLength = 500)

# Run progress: 88,89% complete, ETA 00:05:05
# Fork: 1 of 5
# Warmup Iteration   1: 47525,590 us/op
# Warmup Iteration   2: 46115,709 us/op
# Warmup Iteration   3: 45849,859 us/op
Iteration   1: 45897,641 us/op
Iteration   2: 43321,215 us/op
Iteration   3: 43312,465 us/op

# Run progress: 90,00% complete, ETA 00:04:35
# Fork: 2 of 5
# Warmup Iteration   1: 47665,444 us/op
# Warmup Iteration   2: 45096,301 us/op
# Warmup Iteration   3: 45864,277 us/op
Iteration   1: 43013,711 us/op
Iteration   2: 42339,972 us/op
Iteration   3: 42791,407 us/op

# Run progress: 91,11% complete, ETA 00:04:04
# Fork: 3 of 5
# Warmup Iteration   1: 50054,597 us/op
# Warmup Iteration   2: 46720,184 us/op
# Warmup Iteration   3: 46180,592 us/op
Iteration   1: 43980,906 us/op
Iteration   2: 43750,936 us/op
Iteration   3: 43776,608 us/op

# Run progress: 92,22% complete, ETA 00:03:33
# Fork: 4 of 5
# Warmup Iteration   1: 48756,846 us/op
# Warmup Iteration   2: 45246,834 us/op
# Warmup Iteration   3: 45086,426 us/op
Iteration   1: 43906,298 us/op
Iteration   2: 42735,755 us/op
Iteration   3: 43194,131 us/op

# Run progress: 93,33% complete, ETA 00:03:03
# Fork: 5 of 5
# Warmup Iteration   1: 47861,253 us/op
# Warmup Iteration   2: 48621,843 us/op
# Warmup Iteration   3: 46487,251 us/op
Iteration   1: 43115,808 us/op
Iteration   2: 43081,605 us/op
Iteration   3: 43644,278 us/op


Result "org.sample.MyBenchmark.inputStream":
  43457,516 ±(99.9%) 877,389 us/op [Average]
  (min, avg, max) = (42339,972, 43457,516, 45897,641), stdev = 820,710
  CI (99.9%): [42580,127, 44334,905] (assumes normal distribution)


# JMH version: 1.21
# VM version: JDK 1.8.0_192, OpenJDK 64-Bit Server VM, 25.192-b26
# VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java
# VM options: <none>
# Warmup: 3 iterations, 5 s each
# Measurement: 3 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.inputStream
# Parameters: (numberStrings = 10000, stringLength = 5000)

# Run progress: 94,44% complete, ETA 00:02:32
# Fork: 1 of 5
# Warmup Iteration   1: 578493,709 us/op
# Warmup Iteration   2: 462082,734 us/op
# Warmup Iteration   3: 467347,992 us/op
Iteration   1: 472917,640 us/op
Iteration   2: 470610,906 us/op
Iteration   3: 472164,359 us/op

# Run progress: 95,56% complete, ETA 00:02:02
# Fork: 2 of 5
# Warmup Iteration   1: 569572,976 us/op
# Warmup Iteration   2: 470263,444 us/op
# Warmup Iteration   3: 463845,097 us/op
Iteration   1: 461946,409 us/op
Iteration   2: 449404,169 us/op
Iteration   3: 459048,895 us/op

# Run progress: 96,67% complete, ETA 00:01:31
# Fork: 3 of 5
# Warmup Iteration   1: 572848,457 us/op
# Warmup Iteration   2: 462655,771 us/op
# Warmup Iteration   3: 462688,025 us/op
Iteration   1: 462351,020 us/op
Iteration   2: 469415,309 us/op
Iteration   3: 479655,348 us/op

# Run progress: 97,78% complete, ETA 00:01:01
# Fork: 4 of 5
# Warmup Iteration   1: 563050,381 us/op
# Warmup Iteration   2: 471968,031 us/op
# Warmup Iteration   3: 494291,141 us/op
Iteration   1: 479511,526 us/op
Iteration   2: 471486,229 us/op
Iteration   3: 477723,482 us/op

# Run progress: 98,89% complete, ETA 00:00:30
# Fork: 5 of 5
# Warmup Iteration   1: 570047,550 us/op
# Warmup Iteration   2: 501632,491 us/op
# Warmup Iteration   3: 471064,393 us/op
Iteration   1: 472906,597 us/op
Iteration   2: 464754,667 us/op
Iteration   3: 467134,478 us/op


Result "org.sample.MyBenchmark.inputStream":
  468735,402 ±(99.9%) 8793,146 us/op [Average]
  (min, avg, max) = (449404,169, 468735,402, 479655,348), stdev = 8225,115
  CI (99.9%): [459942,256, 477528,549] (assumes normal distribution)


# Run complete. Total time: 00:45:57

REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
experiments, perform baseline and negative tests that provide experimental control, make sure
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
Do not assume the numbers tell you what you want them to tell.

Benchmark                      (numberStrings)  (stringLength)  Mode  Cnt       Score      Error  Units
MyBenchmark.arrayOfByteArrays              100              50  avgt   15      41,114 ±    1,055  us/op
MyBenchmark.arrayOfByteArrays              100             500  avgt   15     356,393 ±   12,372  us/op
MyBenchmark.arrayOfByteArrays              100            5000  avgt   15    3604,313 ±  147,758  us/op
MyBenchmark.arrayOfByteArrays             1000              50  avgt   15     454,269 ±   11,500  us/op
MyBenchmark.arrayOfByteArrays             1000             500  avgt   15    3854,090 ±   89,434  us/op
MyBenchmark.arrayOfByteArrays             1000            5000  avgt   15   35418,747 ±  914,007  us/op
MyBenchmark.arrayOfByteArrays            10000              50  avgt   15    4699,386 ±  179,792  us/op
MyBenchmark.arrayOfByteArrays            10000             500  avgt   15   37693,202 ±  338,053  us/op
MyBenchmark.arrayOfByteArrays            10000            5000  avgt   15  374780,519 ± 6977,959  us/op
MyBenchmark.inputStream                    100              50  avgt   15      42,868 ±    0,825  us/op
MyBenchmark.inputStream                    100             500  avgt   15     377,458 ±    6,444  us/op
MyBenchmark.inputStream                    100            5000  avgt   15    3736,556 ±   45,051  us/op
MyBenchmark.inputStream                   1000              50  avgt   15     450,259 ±    9,863  us/op
MyBenchmark.inputStream                   1000             500  avgt   15    3868,485 ±   85,223  us/op
MyBenchmark.inputStream                   1000            5000  avgt   15   39474,876 ± 1023,145  us/op
MyBenchmark.inputStream                  10000              50  avgt   15    4962,622 ±  104,886  us/op
MyBenchmark.inputStream                  10000             500  avgt   15   43457,516 ±  877,389  us/op
MyBenchmark.inputStream                  10000            5000  avgt   15  468735,402 ± 8793,146  us/op

@jjlauer
Copy link
Member

jjlauer commented Dec 14, 2018 via email

@Serranya
Copy link
Contributor Author

I think you are right. I will update the PR to use the InputStream implementation I used in the arrayOfByteArrays test

@Serranya
Copy link
Contributor Author

I updated the PR.

@bendem
Copy link
Contributor

bendem commented Jan 21, 2019

@Serranya, I got some time to look into it and here is what I came up with:

When running with low memory (5MB) on large templates (23KB), using a custom input stream is faster than collecting to a byte array and copying.

java -jar target/benchmarks.jar -jvmArgs '-Xmx5M' -rf json -rff 'jmh-output-5M.json' -si false -gc true -f 2 -w 5 -r 5

5m-heap

When running with normal memory (100MB) on large enough templates (23KB), using a custom input stream is slow than collecting to a byte array and copying.

java -jar target/benchmarks.jar -jvmArgs '-Xmx5M' -rf json -rff 'jmh-output-5M.json' -si false -gc true -f 2 -w 5 -r 5
java -jar target/benchmarks.jar -jvmArgs '-Xmx100M' -rf json -rff 'jmh-ouput-100M.json' -f 2 -w 5 -r 5

100m-heap

I didn't find time to measure GC pressure and memory usage on both.

My experiments are available in my fork: https://github.com/bendem/rocker/tree/benchmarks/rocker-benchmarks

@bendem
Copy link
Contributor

bendem commented Jan 21, 2019

Pondering a bit more on the results, we can see that performance is not affected by memory constraint except for the ByteArrayInputStream version that varies widely depending on the amount of available memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants