Skip to content

maniartech/golang-expression-evaluation-comparison

 
 

Repository files navigation

Go expression evaluation comparison

I've created an expression evaluation package and wanted to compare it performance against other similar project. So I created this repository with benchmarks for various packages.

Benchmarks are run with the following specs:

goos: darwin
goarch: arm64
cpu: Apple M2

Benchmarks:

Benchmark_expr-16              	137016453	        88.48 ns/op
Benchmark_celgo-16             	 92916652	       124.1 ns/op
Benchmark_goja-16              	 60208682	       193.8 ns/op
Benchmark_govaluate-16         	 58859652	       202.4 ns/op
Benchmark_otto-16              	 25687690	       468.9 ns/op
Benchmark_gval-16              	 21687690	       560.2 ns/op
Benchmark_evalfilter-16        	  9774505	      1193 ns/op
Benchmark_bexpr-16             	  8394094	      1454 ns/op
Benchmark_starlark-16          	  2531481	      4658 ns/op
Benchmark_uexl-16              	  1276472	      9388 ns/op

And additional benchmarks for some specific cases.

Starts with:

Benchmark_expr_startswith-16   	 71279139	       167.5 ns/op
Benchmark_celgo_startswith-16  	 62182448	       192.5 ns/op
Benchmark_uexl_startswith-16   	  1266170	      9877 ns/op

Custom function call:

Benchmark_expr_func-8          	260001452	        92.33 ns/op
Benchmark_celgo_func-8         	217867923	       110.2 ns/op
Benchmark_uexl_func-8          	[TBD]	           [TBD] ns/op

Map predicate:

Benchmark_expr_map-8           	 5089671	      4695 ns/op
Benchmark_celgo_map-8          	  982980	     24421 ns/op
Benchmark_uexl_map-8           	[TBD]	         [TBD] ns/op

Usage

You can clone repo and run benchmarks yourself.

go test -bench=. -benchtime=20s

About

Go expression evaluation comparison

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%