I've been trying to run some benchmarks and see how -O2, -O3 and -Ofast compare.
However, when compiling with either -d:release or -d:danger, it seems as if Nim sticks an -O3 regardless of what options have been passed via --passC:.
So... the question is: is there any way to keep e.g. the -d:release option and actually change the optimization flags to something other than -O3?
Since, apparently the -O3 option comes from --opt:speed, I've tried it again (and again) with this:
-d: release --opt:none --passC:-O2 --passC:-fno-ident
And... I think I got it to work! (admittedly, not really suprised by the outcome; -O3 seems to be a very decent choice, but still... I had to see for myself...)
I would disagree with this, typescript is transpiled to javascript because they have similar levels of abstraction, and also they have pretty much the same syntax, one implements a type system, the other doesn't, that is the major difference between the two languages. Furthermore I disagree with the argument transpilation depends on abstraction, its easier to see transpiling as one programming language to another, but then it is hard to define compilation.
If we see transpiling as a subset of compiling, all transpiling is compiling, but not all compiling is transpiling, that would make more sense. But then again this is an argument over definitions, people have different definitions for different things, and therefore there is no true right answer.
This is the same argument as "Is HTML a programming language", google says yes, and other people say yes too, and a lot of devs say no (me included), different definitions, different ideas, cause different results.
As for me, nim is transpiled, but it is also compiled, its easier to define a language into another programming language as transpiled, as it makes more sense, if nim went directly into bytecode I would only define it as compiled, but it is going into C, C is still used as a programming language, not an intermediate representation like LLVM, and therefore its more transpiling, which I still see as compiling.
The two posts are a little bit different. While you have asked how to pass option to the gcc compiler, @drkameleon knew how to do it. Its question was about the -O2 flag and not the -O3 flag.
There is still an open question. Can we have -O2 (which is useful by example for profiling code), without having to throw away all --opt:speed optimisations ? If yes, is it possible to do it without having to do a specific Makefile ?
This is an issue if flags given with --passC are overwritten by other Nim flags silently. Shouldn't it parse --passC flags and compare them with Nim flags, and give higher priority to --passC flags ?