Kim, These are not useful results. Exponential recursive algorithms are known to be very expensive. Use an iterative algorithm.
See Fibonacci Numbers and Binomial Coefficients: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.137.752&rep=rep1&type=pdf For example, $ go version go version devel +9ef5ee911c Tue Aug 7 14:36:14 2018 +0000 linux/amd64 $ go test fib_test.go -bench=. goos: linux goarch: amd64 BenchmarkRecursive-4 1 4617595761 ns/op BenchmarkIterative-4 50000000 28.2 ns/op Code: https://play.golang.org/p/zyXqNt3knAM What results do you get with an iterative algorithm? Peter On Friday, August 10, 2018 at 6:28:01 AM UTC-4, netbrain wrote: > > So been playing around with go and wasm support on go version devel > +479da24aac Fri Aug 10 00:47:31 2018 +0000 linux/amd64 > > Curious on performance i tried implementing a Fibonacci algorithm function > in JS and compared it to it's equivalent in GO. Calculating fib(44) takes > 11 seconds on my machine in JS and in GO it takes 36 seconds. > > Any idea's to why I would get these results? I know wasm is very much an > experimental feature of go, however I expected at least equal to or better > performance than JS. Are there any browser optimizations which is running > in my JS code which may not be in effect in wasm? > > Test code available at > https://github.com/netbrain/kata/tree/master/go/wasm > > Cheers > Kim > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.