mgravell / fast-member

Automatically exported from code.google.com/p/fast-member
Apache License 2.0
1.02k stars 141 forks source link

Convert performance tests to use BenchmarkDotNet #16

Closed mattwarren closed 8 years ago

mattwarren commented 8 years ago

I'll leave it up to you whether you want to accept this or not, but I just wanted to show you what it would look like if the performance tests were re-written to use BenchmarkDotNet (full disclaimer, I'm one of the authors)

This is the output you get in the console

fastmember performance tests with benchmarkdotnet

Or in markdown friendly format:

BenchmarkDotNet-Dev=v0.9.1.0+
OS=Microsoft Windows NT 6.1.7601 Service Pack 1
Processor=Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz, ProcessorCount=8
Frequency=2630771 ticks, Resolution=380.1167 ns
HostCLR=MS.NET 4.0.30319.42000, Arch=32-bit RELEASE
JitModules=clrjit-v4.6.100.0
Method Median StdDev Scaled
1. Static C# 9.4196 ns 0.1269 ns 1.00
2. Dynamic C# 52.0478 ns 11.2937 ns 5.53
3. PropertyInfo 531.5502 ns 1.9314 ns 56.43
4. PropertyDescriptor 935.3427 ns 3.8777 ns 99.30
5. TypeAccessor.Create 85.0064 ns 2.4825 ns 9.02
6. ObjectAccessor.Create 87.7486 ns 0.1910 ns 9.32
7. c# new() 32.2484 ns 0.1598 ns 3.42
8. Activator.CreateInstance 66.5984 ns 2.1463 ns 7.07
9. TypeAccessor.CreateNew 35.3345 ns 3.3308 ns 3.75

For reference this .zip file contains all the files that are generated after a run (.csv, .log and markdown)

dotnetchris commented 8 years ago

@mattwarren i really like the scale number, makes it far more understandable.

mattwarren commented 8 years ago

@dotnetchris yeah they are helpful, it was actually an accidental feature.

We found that people using BenchmarkDotNet were calculating the scaled value themselves and manually putting it into the results, so we figured it would be easier if we made is a built-in option.