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.

Reply via email to