Just found out something people haven't mentioned yet (or I missed it?). According to [https://nim-lang.org/docs/system.html](https://nim-lang.org/docs/system.html) `echo` is equivalent to a `writeLine` and a `flushFile`, so each time I call `echo` it flushes the output, which is not necessary. After I replaced `echo x` in my code with `writeLine(stdout, x)`, it helped quite a bit.
Using using split iterator instead of assigning split() return to a variable helps too.
