Compiletime Vs Runtime bencmarks

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 18 01:25:02 PDT 2015


On Tuesday, 18 August 2015 at 07:16:32 UTC, D_Learner wrote:
> On Monday, 17 August 2015 at 22:01:32 UTC, John Colvin wrote:
>> On Monday, 17 August 2015 at 17:48:22 UTC, D_Learner wrote:
>>> On Monday, 17 August 2015 at 14:52:18 UTC, Edwin van Leeuwen 
>>> wrote:
>>>> [...]
>>>
>>> The surprisingly, the D-profiler gives plausible results:-
>>> Algorithm1
>>> 2921           int rtime_pre.bm_rmatch (runtime )
>>> 2122           int ctime_pre.bm_cmatch  (compiletime )
>>>
>>> 1317            int rtime_pre.bmh_rmatch  (runtime )
>>> 1099            int ctime_pre.bmh_cmatch   (compiletime )
>>>
>>>
>>> 3959             int rtime_pre.ag_rmatch     (runtime )
>>> 2688             pure int ctime_pre.ag_cmatch   (compiletime )
>>>
>>> This suggests that my timer design has some flaw ;)
>>
>> std.datetime.StopWatch is the easiest way to do timing 
>> manually, or just use std.datetime.benchmark
>
> My code already uses std.datetime.StopWatch , but I get results 
> which are no match to the D profiler's. Though am not searching 
> for exact, but theyy must be comparable atleast.

When you say D profiler, you mean dmd's built-in profiler, yes? 
That is an instrumenting profiler which adds a not insignificant 
cost to function calls, which means you have to be careful 
interpreting the results


More information about the Digitalmars-d-learn mailing list