-noboundscheck

Nvirjskly nvirjskly at gmail.com
Sun Aug 19 13:13:15 PDT 2012


On Sunday, 19 August 2012 at 20:07:32 UTC, Jonathan M Davis wrote:
> 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.
>

I am using dmd.

Yes, my code is extremely array heavy with many array-based 
computations (Shame-less plug: 
https://github.com/Nvirjskly/cryptod)

> 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

Ah, that makes a lot of sense. If my goal is a fast running time 
would it then make sense to use another compiler? I heard that 
gdc development is lagging behind and that ldc might not even 
support D2 all that well?



More information about the Digitalmars-d-learn mailing list