Skip to content

Instantly share code, notes, and snippets.

@sonOfRa
Last active December 17, 2019 15:38
Show Gist options
  • Save sonOfRa/63bd219888a5c90be4d5334d183cc2ff to your computer and use it in GitHub Desktop.
Save sonOfRa/63bd219888a5c90be4d5334d183cc2ff to your computer and use it in GitHub Desktop.
Boyer-Moore vs naive Java indexOf with larger strings; Haystack is 100k times the string
# OpenJDK Runtime Environment (build 11.0.5-ea+10-post-Ubuntu-0ubuntu1)
Benchmark Mode Samples Score Score error Units
c.z.MyBenchmark.boyerMoore thrpt 200 94.480 2.009 ops/s
c.z.MyBenchmark.java thrpt 200 42.771 0.190 ops/s
# Hello, nanana world! I anana am a string; perhaps nanas I can ananate how, anana for ananananananars, and nanas more!
# OpenJDK Runtime Environment (build 1.8.0_232-ea-8u232-b09-0ubuntu1-b09)
Benchmark Mode Samples Score Score error Units
c.z.MyBenchmark.boyerMoore thrpt 200 90.397 0.501 ops/s
c.z.MyBenchmark.java thrpt 200 46.943 0.518 ops/s
# Hello, nanana world! I anana am a string; perhaps nanas I can ananate how, anana for ananananananars, and nanas more!
# OpenJDK Runtime Environment (build 11.0.5-ea+10-post-Ubuntu-0ubuntu1)
Benchmark Mode Samples Score Score error Units
c.z.MyBenchmark.boyerMoore thrpt 200 91.843 0.437 ops/s
c.z.MyBenchmark.java thrpt 200 42.487 0.141 ops/s
# Hello, world! I am a string; perhaps I can ananate how, for ananananananars, and more!
# OpenJDK Runtime Environment (build 1.8.0_232-ea-8u232-b09-0ubuntu1-b09)
Benchmark Mode Samples Score Score error Units
c.z.MyBenchmark.boyerMoore thrpt 200 113.628 1.064 ops/s
c.z.MyBenchmark.java thrpt 200 78.968 0.544 ops/s
# Hello, world! I am a string; perhaps I can ananate how, for ananananananars, and more!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment