staticIndexOf is incredibly slow and memory intensive
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sun Aug 26 14:15:49 PDT 2012
On 8/26/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> If I replace it
> with my own hardcoded function below it takes only 5 seconds and uses
> 150 MB RAM. This is what the function looks like:
An even faster version, twice as fast:
template myStaticIndexOf(T, TList...)
{
static if (!__traits(compiles, TList[0]))
enum myStaticIndexOf = -1;
else
static if (is(T == TList[0]))
enum myStaticIndexOf = 0;
else
// repeat..
}
More information about the Digitalmars-d
mailing list