std.benchmark is in reviewable state
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Oct 3 11:04:41 PDT 2011
On 10/3/11 12:49 PM, Jacob Carlborg wrote:
> On 2011-10-03 17:44, Andrei Alexandrescu wrote:
>> On 10/3/11 8:59 AM, Jens Mueller wrote:
>>> 4. Test results should be exposed to the caller.
>>> Usually, it is enough to write the results to the console. But you may
>>> want to post process the results. Being it either graphically or to
>>> output XML for whatever reason.
>>> I think it would be beneficial to add this flexibility and separate the
>>> benchmarking logic from its generating the output.
>>> It might be useful to add the used CPU using std.cpuid to the output.
>>
>> We should decouple collection from formatting. However, this complicates
>> matters because we'd need to expose the benchmark results structure.
>> I'll think of it.
>
> Not necessarily. The user could provide a delegate as a callback,
> something like this:
>
> struct Result
> {
> string func;
> double relative;
> double calls;
> double tCall;
> double callsPerSecond;
> }
>
> alias void delegate (Result result) Formatter;
That's what I meant when I said "we'd need to expose the benchmark
results structure" :o).
There's probably no way out of this anyway, particularly if we provide
richer information via times(), scalability, etc.
Andrei
More information about the Digitalmars-d
mailing list