speeding up + ctfe question

jerro a at a.com
Sun May 27 07:31:58 PDT 2012


> I ran in two problems. It was extremely fast when sieving a 
> byte array
> of 1 million entries (without optimizations at all) but when 
> trying
> with 10_000_000 entries the program crashes before it even 
> starts to
> execute (main isn't reached).

You say it does compile, but then crashes immediatly? I can't
reproduce that. For me it is a compile time error if toSieve
is 16MB or more, but otherwise it runs fine. Anyway you should
use a dynamic array instead of a static one if you want really
large arrays.

> Then I decided to benchmark the code and dmd fails to compile 
> with
> "Internal error: ..\ztc\cgcs.s 354".
>
> I assume the first problem has to do with memory limits and 
> that the
> second is a little dmd bug.

It is a bug, all internal errors are. It looks like you can
avoid like this:

auto tmp=(benchmark!(f0)(1000));
int time=tmp[0].to!("msecs", int);


More information about the Digitalmars-d-learn mailing list