Nim: -d:release vs -d:anger size/performance impact

Created on 30 Jul 2019  路  9Comments  路  Source: nim-lang/Nim

@krux02 recently mentioned that "koch temp recently got much slower."

This seems related to 721534119000c2bd53cc72b531726a6104381222, which causes the nim binary to be significantly bigger (30% for me) and slower (up to 70% for me). This is to be expected given the change in semantics of -d:release, but I'm not sure if the resulting performance hit is intended. Should the Nim compiler itself maybe be built with -d:danger instead?

Installation Performance Tools

Most helpful comment

Well, @Araq did a change. The flag -d:release now has all runtime flags enabled. -d:danger is what was -d:release before. Since I did not have problems with the way -d:release worked, I had to change my workflow to -d:danger in order to be not affected by this change. I don't think changing the semantics of an existing flag under the hood is a very bad idea. I think this change should have gone through a proper RFC process, because it affects almost everybody.

All 9 comments

Well, @Araq did a change. The flag -d:release now has all runtime flags enabled. -d:danger is what was -d:release before. Since I did not have problems with the way -d:release worked, I had to change my workflow to -d:danger in order to be not affected by this change. I don't think changing the semantics of an existing flag under the hood is a very bad idea. I think this change should have gone through a proper RFC process, because it affects almost everybody.

We can produce much better code for integer overflow checking but it's unclear how much of a speedup this will bring. We hope to have a workable "Incremental compilation" feature within months, so compile-times will be improved quite a bit.

Hi, I want to ask whether -d:danger is equivalent to -d:release -x:off after the change or there is also some other checks which should be disabled to get the same effect? I'm asking because I want to use build equivalent to -d:danger, but also I want to use the same build script for Nim versions before and after 0.20.0.

@bobeff just use -d:release -d:danger

Hi, I want to ask whether -d:danger is equivalent to -d:release -x:off after the change or there is also some other checks which should be disabled to get the same effect?

Yes, -d:danger is -d:release -x:off and -d:release -x:off works on all known Nim versions.

What's the pending action for this issue?

Faster integer checking is available in a branch that will be merged too. Once that's done, we can close this issue.

can we close this now? I don't see any other action items and -d:danger has been there for a while. Note that many other flags can improve performance further (but it's problem dependent and can sometimes hurt performance), eg --passc:-flto + usual suspects clang optimization flags

Faster integer checking is available in a branch that will be merged too. Once that's done, we can close this issue.

was merged see https://github.com/nim-lang/Nim/pull/13626#issuecomment-597930095

We can produce much better code for integer overflow checking but it's unclear how much of a speedup this will bring

see https://github.com/nim-lang/RFCs/issues/199 for some benchmarks

Indeed, thanks.

Was this page helpful?
0 / 5 - 0 ratings