4 ms·
I'm keeping watch on Crystal and Zig personally. Crystal looks like a near perfect language for my style with one major caveat being compilation speeds. I'm a s
by bestinterest 5y ago
I'm keeping watch on Crystal and Zig personally. Crystal looks like a near perfect language for my style with one major caveat being compilation speeds. I'm a sucker for a dynamic language feedback loop, I'm curious how Nim is on that front if anyone knows.
I tried Rust but it was too much for my small brain and seeing multiple blog posts about people spending years with it and still not getting the borrow checker down perfectly is putting me down a little. Perhaps I'll try it again down the line.
- cb321 5y agoNim has extremely low compilation times...order 200 millisec with the TinyCC/tcc backend and order 800 millisec with gcc (both for the zero length empty module). Less trivial projects (say transitively importing 25 modules) are more like 1.2 seconds and 5..6 seconds. All of these numbers are about to improve quite a bit with incremental compilation which is under active development, but they are already quite friendly/fast code-test-code again cycles. You can even write a "script" by putting "#!/usr/bin/nim r" at the top of your file (like #/bin/sh) and making it executable. (With nim r the compilation will be cached and so not require much time at all.) I would not call Nim a scripting language as typically understood (e.g. with 100 usec to 15 msec startups), but both compile|use cached & run makes it more similar than most alternatives. pypy3 on an empty file on the same machine as the above timings takes 40 ms, for example. There is also a mode called "nim script" where rather than running an external C/C++/nodejs compiler a restricted subset can be compiled and run right on the same VM Nim uses for its Lisp-like macro facility. That only takes about 100 ms, but the savings relative to 200..250 ms with no subset restrictions may not be very compelling. TL;DR is that Nim gives you a lot of options. In this and in most things, really (memory management, code style, etc., etc.).