node.js vs. kotlin as a server side development

8 points by idreamer ↗ HN
Hello.

I have developed services with nodejs and I wonder a performance comparison between nodejs and kotlin as a server side development.

10 comments

[ 1.7 ms ] story [ 50.3 ms ] thread
(comment deleted)
I would go with Kotlin 90% of the time. It's faster, has better syntax, strong type checks, great ecosystem and community (Jetbrains, Spring, Google support it). It has some wicked cool Reactive support and scales pretty well. So I would go with Kotlin.

Unless, you want to build a prototype and do not know the language. NodeJS may help you get started quickly.

Want to first say that I've been using and working professionally with node since v0.10. I love it and don't want to give the impression that I am a hater at all.

That said, at my place of employment I am currently in the middle of migrating OFF a node server (your typical express stack) to a Kotlin/Spring based one. I think I have the perspective you want in other words.

My recommendation is use Kotlin. Its fast, interops with the entire Java ecosystem and all its libraries, has a fantastic and sane type system (think TypeScript on steroids) and fantastic tooling. Its also pretty easy to pick up. I had never worked with it before and I was up and running on day one with it.

In general, Kotlin is 5-10x faster than JS and uses 1/2 the memory.

The speed difference depends on what you're doing, but I would guess it's rare to find situations where Kotlin is less than twice as fast

(comment deleted)
this page might help https://www.techempower.com/benchmarks/

But is raw cpu time really what matters most for you or solving a problem in away that can be scaled and maintained in away that you understand maybe more important?

If you're thinking about web development in Kotlin, check out https://kweb.io/.

It takes full advantage of powerful Kotlin features like coroutines to make the barrier between browser and server almost invisible.

If you make use of the NPM ecosystem you are inviting security holes into your product. Stay away.
Kotlin is easier to work with for large projects. You're less inclined to write messy code than JS.