Benchmarks

138 views
Skip to first unread message

Rohan Verma

unread,
Apr 8, 2019, 10:49:09 AM4/8/19
to CEL Go Discussion Forum
Hey,

I tried to write a benchmark for comparing govaluate and cel-go as I could not find the wiki page mentioned in the README.

The results:

go test -benchmem -bench .
goos: linux
goarch: amd64
pkg: benchcelgo
BenchmarkCelGo-4         3000000               487 ns/op              56 B/op          3 allocs/op
BenchmarkGovaluate-4     2000000               836 ns/op              80 B/op          6 allocs/op
PASS
ok      benchcelgo      4.698s


I have uploaded the code here:

Please suggest if my methodology is correct or not and if any improvements can be made in the benchmark.

Thanks and regards
Rohan

Tristan Swadell

unread,
Apr 8, 2019, 11:57:42 AM4/8/19
to Rohan Verma, CEL Go Discussion Forum
Hi Rohan,

Nice work! The benchmark looks great. 

I just hadn't gotten around to writing up the wiki yet which is why you couldn't find it. I wanted to go into more depth on the trade-offs between different use cases and  considerations for picking an expression evaluator, such as ease of use, parse / eval only, etc.  However, from a pure evaluation standpoint, you've nailed it. :) 

-Tristan


--
You received this message because you are subscribed to the Google Groups "CEL Go Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cel-go-discus...@googlegroups.com.
To post to this group, send email to cel-go-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cel-go-discuss/2b128d60-c85c-4f2f-9049-6d5a704dda68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tristan Swadell

unread,
Apr 8, 2019, 4:26:29 PM4/8/19
to Rohan Verma, CEL Go Discussion Forum
Looks like there is a small bug where there's a missing string concatenation for CEL-go, so once that's fixed you'll want to re-run.

-Tristan

Rohan Verma

unread,
Apr 9, 2019, 2:05:31 AM4/9/19
to CEL Go Discussion Forum
Ah, I guess I missed that. After fixing it and running again, the benchmarks seem to be performing similarly.

go test -cpuprofile cpu.prof -memprofile mem.prof -benchmem -bench .

goos: linux
goarch: amd64
pkg: benchcelgo
BenchmarkCelGo-4         2000000               656 ns/op              88 B/op          5 allocs/op
BenchmarkGovaluate-4     2000000               702 ns/op              72 B/op          5 allocs/op
PASS
ok      benchcelgo      4.321s


Regards
Rohan
To unsubscribe from this group and stop receiving emails from it, send an email to cel-go-...@googlegroups.com.
mem.prof
cpu.prof

Tristan Swadell

unread,
Apr 9, 2019, 11:53:51 AM4/9/19
to Rohan Verma, CEL Go Discussion Forum
Thanks for re-running the benchmarks. Govaluate is a clean fast little library. I think in my own benchmarks There's a pretty aggressive function binding step at program plan time that happens in both CEL-Go and Govaluate, but CEL's is a bit more exhaustive in trying to bind extensions to program steps, so it happened to perform better in the example from the README.

The biggest time and memory cost in CEL-Go is the conversion of inputs to CEL types. It's possible to avoid this, but would require a pretty significant refactor of the code. Early tests showed a 2x speed improvement though. 

-Tristan
 

To unsubscribe from this group and stop receiving emails from it, send an email to cel-go-discus...@googlegroups.com.

To post to this group, send email to cel-go-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages