-noboundscheck

Jonathan M Davis jmdavisProg at gmx.com
Sun Aug 19 13:07:16 PDT 2012


On Sunday, August 19, 2012 21:29:38 Nvirjskly wrote:
> Compiling my code with the -noboundscheck flag sped it up by
> almost 5 times (whilst passing all tests and working exactly the
> same way,) is bounds checking really that expensive, and what
> other simple optimisations can I preform other than -inline -O
> -noboundscheck?

It would depend entirely on your code. In most cases, I wouldn't expect to see 
a speed up anywhere near that large. But if you're constantly accessing arrays 
and doing little other computation, then maybe you do. I have no idea what 
your code is doing.

dmd's optimizer isn't the best anyway. It compiles much faster than gdc and 
ldc do, but it usually generates slower code (the focus on dmd has generally 
been getting everything working correctly rather than optimizing everything to 
death, though that should change with time). Whatever the situation with your 
code is, I'd expect that that the situation with its optimizations would 
change quite a bit with one of the other D compilers.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list