Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@melix
Last active August 29, 2015 14:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melix/ea819c77c4b568660877 to your computer and use it in GitHub Desktop.
Save melix/ea819c77c4b568660877 to your computer and use it in GitHub Desktop.
Fibonacci Benchmark
# Run complete. Total time: 00:34:14
Benchmark Mode Samples Score Error Units
o.g.m.f.FibonacciMicroBenchmark.groovy_primitive_cs avgt 30 1.961 ± 0.055 ms/op
o.g.m.f.FibonacciMicroBenchmark.baseline_java_30 avgt 30 2.004 ± 0.084 ms/op
o.g.m.f.FibonacciMicroBenchmark.baseline_java_boxing_30 avgt 30 5.504 ± 0.036 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_primitive_30 avgt 30 5.733 ± 0.024 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_indy_30 avgt 30 5.903 ± 0.033 ms/op
o.g.m.f.FibonacciMicroBenchmark.golo_30 avgt 30 6.545 ± 0.060 ms/op
o.g.m.f.FibonacciMicroBenchmark.nashorn_30 avgt 30 7.812 ± 0.061 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_indy_primitive_30 avgt 30 8.033 ± 0.130 ms/op
o.g.m.f.FibonacciMicroBenchmark.clojure_30 avgt 30 9.277 ± 0.161 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_30 avgt 30 23.930 ± 0.228 ms/op
o.g.m.f.FibonacciMicroBenchmark.jruby_30 avgt 30 25.868 ± 0.663 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_primitive_cs_40 avgt 30 238.734 ± 0.994 ms/op
o.g.m.f.FibonacciMicroBenchmark.baseline_java_40 avgt 30 238.913 ± 2.652 ms/op
o.g.m.f.FibonacciMicroBenchmark.baseline_java_boxing_40 avgt 30 703.751 ± 15.198 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_primitive_40 avgt 30 710.078 ± 6.669 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_indy_40 avgt 30 726.623 ± 7.280 ms/op
o.g.m.f.FibonacciMicroBenchmark.golo_40 avgt 30 800.427 ± 10.386 ms/op
o.g.m.f.FibonacciMicroBenchmark.nashorn_40 avgt 30 961.904 ± 10.431 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_indy_primitive_40 avgt 30 992.273 ± 23.452 ms/op
o.g.m.f.FibonacciMicroBenchmark.clojure_40 avgt 30 1131.375 ± 7.095 ms/op
o.g.m.f.FibonacciMicroBenchmark.groovy_40 avgt 30 2937.296 ± 21.417 ms/op
o.g.m.f.FibonacciMicroBenchmark.jruby_40 avgt 30 3153.625 ± 46.717 ms/op
@melix
Copy link
Author

melix commented Dec 2, 2014

The numbers above are comparing the performance of the infamous Fibonacci benchmark for various dynamic languages. It computes fib(30) or fib(40).

Tests done with Groovy 2.4.0-SNAPSHOT (results may be updated).

VM:

java version "1.8.0_40-ea"
Java(TM) SE Runtime Environment (build 1.8.0_40-ea-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b18, mixed mode)

Why so many Groovy versions of the benchmark ? Basically we tested:

  • untyped Groovy: fib(n)
  • typed Groovy: long fib(long n)
  • invokedynamic versions of the above (_indy, Groovy has 2 runtimes: legacy and indy)
  • statically compiled Groovy (_cs, using @CompileStatic)

see melix/golo-lang@a2148dc

@eugene-kamenev
Copy link

Thanks, but what a thing happen with groovy indy results?

@chensb
Copy link

chensb commented Mar 5, 2015

why groovy_indy_primitive is much slower than groovy_primitive_40 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment