Hacker News new | past | comments | ask | show | jobs | submit login

If you really like the simplicity of C I highly recommend Nim:

* Compiles to C, so you stand on the shoulders of giants wrt compilers.

* Very low overhead GC that doesn't "stop the world".

I was working on a project recently where I had to just write a bunch of stuff to disk, and I tried Node, and then Java, and they were about the same, and I figured - yep, makes sense, it's IO bound.

Nim got twice the throughput w/ an order of magnitude less memory usage! Because the serialization I suppose was the bottleneck and msgpack4nim is pretty fast.




Use mmap and you won't need to write anything to disk; the operating system will do it for you. That's C's killer feature while also being the last thing on earth languages like Node and Java would ever permit developers to do.


> while also being the last thing on earth languages like Node and Java would ever permit developers to do.

You sure about that?

https://www.npmjs.com/package/mmap-io

https://docs.oracle.com/en/java/javase/11/docs/api/java.base...

mmap is a system call, not some C-exclusive fancy feature. If your language can print something on the screen, there is no reason it can't mmap a file.

And if the serialization was the bottleneck, mmap would not have changed anything anyway.


Good idea, will keep that in mind for next time.


By the way, the point here wasn't to do a great language comparison. It was "I have a thing to do, what language/runtime will let me do it easily and fast". Normally I reach for Node for my scripts, but got curious. Nim ended up being less code than the other options, type safe, and fast.


If serialization performance is an issue, then you may want to consider zero-overhead serialization tools like capn proto.


Yeah I know about Cap'n proto etc. Was just saying the tiny language can compete :)

Language comparisons are almost always BS...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: