Hacker News new | ask | show | jobs
by nathan_f77 4014 days ago
This is pretty interesting, although I don't know if it's... necessary.

What do you think are some of the pros/cons between Go and JavaScript? When would you prefer to use JavaScript instead of Go, or vice versa?

I think Go can be more performant than Node.js, but I remember seeing some conflicting benchmarks where V8 can actually manage more RPS.

The other thing that comes to mind is how React Native uses JavaScript to manipulate UI Components on iOS. If Google ever supports Go on Android, then this kind of thing could be pretty interesting.

2 comments

the main goal of CandyJS is allow to other developers build extendable programs without the requirement of compile.

A good example could be a chan bot in Go with plugins written on JS. (like https://github.com/djosephsen/lazlo) but with CandyJS the effort to make this will be minimal, since you can use the same structures on JS and Go.

About the performance, CandyJS javascript is much slower than pure Go, since the reflection is very expensive.

A small quick bench of this example: https://github.com/mcuadros/go-candyjs/blob/master/examples/...

Pure Go: 165951 requests

CandyJS: 36304 requests

That means that CandyJS is 4,5 times slower than pure Go. Both

Duktape is good for scripting. My particular app is a simple rule engine for smart home applications which runs on relatively low-powered ARM board. It would hardly be practical to have Go compiler there, and duktape is resource-efficient ECMAScript engine which serves this purpose just fine.
Oh I see, that's pretty cool!