Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
When using filename.nims on the latest devel (v0.19.9) it somehow creates a slower and more bloated (more RAM used) program than when you pass the flags directly when compiling. This does not happen on 0.19 stable.
Example
The original command, without .nims file:
nim c -d:release --gc:regions nim/day09
produces a file which runs in ~0.25 seconds, taking ~140 MB of RAM.
Putting --gc:regions in a day09.nims file and compiling it produces a file which runs in ~0.50 seconds, taking ~240 MB of RAM.
This is not limited to --gc:regions, a similar thing happens when using --gc:refc flag with the same file:
without .nims: 0.80 seconds, ~330 MB of RAM
with it: 2.80 seconds (yes, two seconds slower), ~380 MB or RAM
Expected Output
To have the same/similar results when using the flags on the command line and in .nims file.
Additional Information
$ nim -v
Nim Compiler Version 0.19.9 [Linux: amd64]
Compiled at 2018-12-15
Copyright (c) 2006-2018 by Andreas Rumpf
active boot switches: -d:release
When using
filename.nims
on the latest devel (v0.19.9) it somehow creates a slower and more bloated (more RAM used) program than when you pass the flags directly when compiling. This does not happen on 0.19 stable.Example
The original command, without
.nims
file:produces a file which runs in ~0.25 seconds, taking ~140 MB of RAM.
Putting
--gc:regions
in aday09.nims
file and compiling it produces a file which runs in ~0.50 seconds, taking ~240 MB of RAM.This is not limited to
--gc:regions
, a similar thing happens when using--gc:refc
flag with the same file:.nims
: 0.80 seconds, ~330 MB of RAMExpected Output
To have the same/similar results when using the flags on the command line and in
.nims
file.Additional Information