Empy program running time
Steven Schveighoffer
schveiguy at yahoo.com
Fri Jul 29 08:23:18 PDT 2011
On Fri, 29 Jul 2011 10:50:52 -0400, bearophile <bearophileHUGS at lycos.com>
wrote:
> Steven Schveighoffer:
>
>> For example, D needs to call all the module ctors and do the import
>> cycle
>> detection algorithm.
>
> Even for an empty program?
Yes. I bet even an empty program has on the order of 50 module ctor/dtors
to run. All the runtime can contain module ctor/dtors, and those modules
are compiled in no matter what. Plus dmd adds hidden modules with
ctor/dtors.
There are other initializations, such as the GC, setting up the main
thread, etc.
>> 0.11 seconds is not unreasonable.
>
> It means about 170_000_000 CPU clock ticks, to me it seems a lot.
I guess if you want to have an empty program benchmark? It doesn't seem
to mean much to me...
If it was on the order of seconds, I'd agree with you. .11 seconds is
barely noticeable.
>> But I'll also stress that timings at this precision can be fairly
>> volatile.
>
> I think this timing precision is not so bad.
What I mean is, the timing for a program can easily vary by 10ths of a
second between runs, depending on what's happening on the computer. Make
sure you do an average, and not a single run to do these kinds of tests.
-Steve
More information about the Digitalmars-d-learn
mailing list