speeding up + ctfe question
jerro
a at a.com
Mon May 28 01:08:18 PDT 2012
> I tried using 6k+-1 for all primes and for some reason it
> performed
> slower. I think I have something completely inefficient
> somewhere,
> can't figure out where though.
You aren't, by any chance, using divisions or remainders? those
are much slower than, say, multiplications (unless the divisor
is a power of two and known at compile time, in which case
the compiler will optimize them to bitwise operations).
> and I haven't tried with optimization on, first I want to get
> the
> algorithm as good as possible before trying to squeeze out
> those extra
> milliseconds :)
I prefer to compile with optimizations on when trying to
optimize something. That way I don't waste my time on
micro-optimizations that the compiler could do for me.
More information about the Digitalmars-d-learn
mailing list