On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote:
Does DMD/LDC avoid range-checking in slice-expressions such as
the one in my array-overload of `startsWith` defined as
bool startsWith(T)(scope const(T)[] haystack,
scope const(T)[] needle)
{
if (haystack.length >= needle.length)
{
return haystack[0 .. needle.length] == needle; // is
slice range checking avoid here?
}
return false;
}
LDC is good at optimizing simple patterns, the only pitfall I
know is
https://forum.dlang.org/post/eoftnwkannqmubhjo...@forum.dlang.org