June 10, 2017
On Saturday, 10 June 2017 at 12:23:05 UTC, Nicholas Wilson wrote:
> On Saturday, 10 June 2017 at 12:16:34 UTC, Honey wrote:
>> Is it expected that turning off bounds checking can lead to a performance decrease?
>
> Yes, with it on you are doing an "is the index <= the length" for every array access. Now some of them can be elided by the complier when it can prove that the index is always in bounds but it is generally dangerous to do so as it opens up the possibility of buffer overflow.

Are you saying that introducing additional checks enables the optimizer to eliminate more or more costly checks than it could without introducing those additional checks in the first place? Can you give an example?
June 10, 2017
On Saturday, 10 June 2017 at 12:44:07 UTC, Honey wrote:
> On Saturday, 10 June 2017 at 12:23:05 UTC, Nicholas Wilson wrote:
>> On Saturday, 10 June 2017 at 12:16:34 UTC, Honey wrote:
>>> Is it expected that turning off bounds checking can lead to a performance decrease?
>>
>> Yes, with it on you are doing an "is the index <= the length" for every array access. Now some of them can be elided by the complier when it can prove that the index is always in bounds but it is generally dangerous to do so as it opens up the possibility of buffer overflow.
>
> Are you saying that introducing additional checks enables the optimizer to eliminate more or more costly checks than it could without introducing those additional checks in the first place? Can you give an example?

My bad I misread the original quote, misread that as performance increase.
turning bounds checks off should always result in faster code.
June 10, 2017
On Saturday, 10 June 2017 at 13:43:48 UTC, Nicholas Wilson wrote:
> On Saturday, 10 June 2017 at 12:44:07 UTC, Honey wrote:
>> On Saturday, 10 June 2017 at 12:23:05 UTC, Nicholas Wilson wrote:
>>> [...]
>>
>> Are you saying that introducing additional checks enables the optimizer to eliminate more or more costly checks than it could without introducing those additional checks in the first place? Can you give an example?
>
> My bad I misread the original quote, misread that as performance increase.
> turning bounds checks off should always result in faster code.

I can confirm on my system, ldc with bounds check off was at least twice as slow as with just -release.

Definitely seems like a bug

-Steve
June 10, 2017
On Saturday, 10 June 2017 at 14:14:53 UTC, Steven Schveighoffer wrote:
> I can confirm on my system, ldc with bounds check off was at least twice as slow as with just -release.
>
> Definitely seems like a bug
>
> -Steve

Ya, see https://github.com/ldc-developers/ldc/issues/2161
June 12, 2017
On Friday, 9 June 2017 at 19:43:55 UTC, Era Scarecrow wrote:
> On Friday, 9 June 2017 at 18:32:06 UTC, Steven Schveighoffer wrote:
>> Wow, so that's how D code would look like if it were C++ :)
>
>  When dipping my toes into C++ to do a quicksort algorithm, I quickly got annoyed I'd have to create all the individual comparison functions rather than just one like in D... Which is

Not sure what you mean by that? You only need one in C++.

http://en.cppreference.com/w/cpp/utility/functional/less


1 2 3
Next ›   Last »