| Thread overview | |||||
|---|---|---|---|---|---|
|
January 21, 2015 Avoiding Slice Checking | ||||
|---|---|---|---|---|
| ||||
As a follow up to https://github.com/D-Programming-Language/dmd/pull/4293 would it be possible to also avoid range-checking in expressions such as x[0 .. $/n] and x[$/n .. $] where n is an integer compile-time constant >= 2. I'm askingbecause this is a reoccurring pattern in D-style binary divide-and-conquer algorithms and would be a good show-case for D from a performance standpoint. Is DMD prepared for (easily) adding this to e2ir.c and expression.c? | ||||
January 22, 2015 Re: Avoiding Slice Checking | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Wednesday, 21 January 2015 at 23:50:44 UTC, Nordlöw wrote:
> As a follow up to
>
> https://github.com/D-Programming-Language/dmd/pull/4293
>
> would it be possible to also avoid range-checking in expressions such as
>
> x[0 .. $/n]
>
> and
>
> x[$/n .. $]
>
> where n is an integer compile-time constant >= 2.
>
> I'm askingbecause this is a reoccurring pattern in D-style binary divide-and-conquer algorithms and would be a good show-case for D from a performance standpoint.
>
> Is DMD prepared for (easily) adding this to e2ir.c and expression.c?
That is reasonable to expect a compiler to remove such a check with optimization enabled already. I'm not sure about DMD, but I'd be willing to bet that LDC and GDC already do it.
| |||
January 22, 2015 Re: Avoiding Slice Checking | ||||
|---|---|---|---|---|
| ||||
Posted in reply to deadalnix | deadalnix:
> That is reasonable to expect a compiler to remove such a check with optimization enabled already. I'm not sure about DMD, but I'd be willing to bet that LDC and GDC already do it.
I think this thread is about an enhancement request for a guaranteed front-end optimization.
Bye,
bearophile
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply