openjdk version "1.9.0-internal" OpenJDK Runtime Environment (build 1.9.0-internal-shade_2014_11_28_00_48-b00) OpenJDK 64-Bit Server VM (build 1.9.0-internal-shade_2014_11_28_00_48-b00, mixed mode) Running 64-bit HotSpot VM. Using compressed references with 3-bit shift. Objects are 8 bytes aligned. Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] String footprint: X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are sizes in bytes. Average footprint per character is in parentheses. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 48 ( 48.0) 48 ( 48.0) 48 ( 48.0) 4 | 48 ( 12.0) 48 ( 12.0) 48 ( 12.0) 16 | 72 ( 4.5) 72 ( 4.5) 72 ( 4.5) 64 | 168 ( 2.6) 168 ( 2.6) 168 ( 2.6) 256 | 552 ( 2.2) 552 ( 2.2) 552 ( 2.2) 1024 | 2088 ( 2.0) 2088 ( 2.0) 2088 ( 2.0) Equals You can run this benchmark selectively with JMH by invoking: $ java -jar string-density-bench.jar Equals [-p size=...] [-p cmp=...] [-prof perfasm] [other JMH params] X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are nanoseconds per operation. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 4.0 ± 0.2 4.0 ± 0.1 4.0 ± 0.1 4 | 4.9 ± 0.1 4.9 ± 0.1 4.8 ± 0.2 16 | 4.7 ± 0.2 4.8 ± 0.1 4.8 ± 0.2 64 | 9.4 ± 4.5 9.2 ± 3.4 9.1 ± 3.5 256 | 18.0 ± 2.5 17.3 ± 2.8 17.1 ± 2.5 1024 | 53.1 ± 8.0 57.5 ± 10.8 57.0 ± 9.9 HashCode You can run this benchmark selectively with JMH by invoking: $ java -jar string-density-bench.jar HashCode [-p size=...] [-p cmp=...] [-prof perfasm] [other JMH params] X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are nanoseconds per operation. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 4.1 ± 0.2 4.1 ± 0.1 4.1 ± 0.1 4 | 6.4 ± 0.5 6.2 ± 0.3 6.2 ± 0.2 16 | 12.1 ± 0.5 12.1 ± 0.3 11.9 ± 0.3 64 | 48.1 ± 1.2 48.0 ± 1.4 47.8 ± 1.6 256 | 196.4 ± 4.0 196.4 ± 5.1 196.9 ± 5.2 1024 | 792.3 ± 23.3 789.9 ± 27.7 784.9 ± 25.7 CompareTo You can run this benchmark selectively with JMH by invoking: $ java -jar string-density-bench.jar CompareTo [-p size=...] [-p cmp=...] [-prof perfasm] [other JMH params] X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are nanoseconds per operation. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 4.2 ± 0.1 4.0 ± 0.1 4.1 ± 0.1 4 | 6.6 ± 0.2 6.6 ± 0.3 6.5 ± 0.2 16 | 8.1 ± 0.6 8.0 ± 0.4 7.9 ± 0.3 64 | 13.6 ± 2.4 13.3 ± 0.9 13.3 ± 0.8 256 | 21.1 ± 2.5 21.2 ± 1.9 20.7 ± 2.3 1024 | 60.6 ± 3.5 60.6 ± 3.3 62.5 ± 4.7 FromCharArray You can run this benchmark selectively with JMH by invoking: $ java -jar string-density-bench.jar FromCharArray [-p size=...] [-p cmp=...] [-prof perfasm] [other JMH params] X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are nanoseconds per operation. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 27.9 ± 12.6 31.0 ± 28.3 21.7 ± 5.8 4 | 20.1 ± 0.6 20.1 ± 1.7 22.3 ± 8.1 16 | 23.9 ± 10.1 23.0 ± 8.5 23.4 ± 9.4 64 | 30.9 ± 29.0 26.4 ± 14.1 29.7 ± 26.1 256 | 78.3 ± 60.0 79.1 ± 58.7 84.7 ± 70.4 1024 | 275.1 ± 200.8 243.2 ± 75.1 273.9 ± 195.3 ToCharArray You can run this benchmark selectively with JMH by invoking: $ java -jar string-density-bench.jar ToCharArray [-p size=...] [-p cmp=...] [-prof perfasm] [other JMH params] X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are nanoseconds per operation. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 19.0 ± 0.7 18.9 ± 0.4 19.0 ± 0.8 4 | 18.3 ± 0.7 18.4 ± 0.7 18.2 ± 0.5 16 | 21.4 ± 7.7 18.7 ± 0.8 21.2 ± 7.4 64 | 27.9 ± 20.6 28.6 ± 21.7 29.4 ± 24.0 256 | 73.7 ± 59.2 74.0 ± 58.4 73.7 ± 58.6 1024 | 263.4 ± 198.3 267.9 ± 199.7 271.9 ± 197.7 IndexOfString You can run this benchmark selectively with JMH by invoking: $ java -jar string-density-bench.jar IndexOfString [-p size=...] [-p cmp=...] [-prof perfasm] [other JMH params] X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are nanoseconds per operation. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 7.3 ± 0.2 7.5 ± 0.3 7.3 ± 0.2 4 | 7.3 ± 0.4 7.5 ± 0.3 7.3 ± 0.3 16 | 8.8 ± 0.4 8.9 ± 0.5 8.8 ± 0.2 64 | 22.0 ± 0.9 22.0 ± 1.1 22.3 ± 1.0 256 | 78.4 ± 1.5 78.4 ± 2.1 77.4 ± 2.6 1024 | 306.4 ± 12.7 307.8 ± 10.1 303.4 ± 12.6 CharAt You can run this benchmark selectively with JMH by invoking: $ java -jar string-density-bench.jar CharAt [-p size=...] [-p cmp=...] [-prof perfasm] [other JMH params] X axis is String size, Y axis is compressibility (% of 1-byte characters in String) Values are nanoseconds per operation. | 0.00 0.50 1.00 ----------------------------------------------------------------------------------------------------- 1 | 4.2 ± 0.2 4.1 ± 0.1 4.1 ± 0.1 4 | 6.1 ± 0.2 6.2 ± 0.3 6.2 ± 0.3 16 | 9.2 ± 0.2 9.7 ± 2.2 9.2 ± 0.1 64 | 19.2 ± 0.8 18.8 ± 1.3 19.0 ± 0.6 256 | 76.1 ± 2.0 74.9 ± 1.7 74.2 ± 2.4 1024 | 270.7 ± 7.4 274.4 ± 7.1 275.2 ± 9.3