Is D still alive?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jan 27 10:14:43 PST 2011
On Thursday, January 27, 2011 09:47:44 bearophile wrote:
> Ulrik Mikaelsson:
> > Isn't the real reason for this that bounds-checking is usually
> > completely turned-off in release-builds?
>
> Bounds checking is turned off in release builds mostly because:
> 1) DMD is not able to infer & remove most bound checks at compile-time as
> the latest Oracle VM are able to do; 2) and because Walter & Co. believe
> such analysis isn't able to remove most bound checks anyway (I have not
> seen this hypothesis confirmed yet).
>
> > Sounds like something that could noticeably degrade runtime-performance
> > for array-intensive code?
>
> The safety net we are talking about is present only at the right bound of a
> slicing syntax (it's not performed in normal array indexing), and it
> consists in a single min(x, $) operation, that's one branch. So it slows
> down code, but only a bit. And in many of such situations you probably
> need to add a min(x, $) manually in the code anyway, so the overhead is
> limited.
Personally, I have _never_ needed to add a min call like that. So, while _you_
may think that it's a common thing to do (and it may be that it is in your
code), that doesn't mean that that's generally true.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list