Skip to content

Benchmarks

ffhighwind edited this page Dec 8, 2019 · 5 revisions

Object Construction

Tests 2000000 iterations
Direct ctor 3 ms
Reflection ctor 280 ms
Fasterflect ctor 225 ms
Fasterflect cached ctor 12 ms

Field Access

Tests 2000000 iterations
Direct set 6 ms
Direct get 3 ms
'dynamic' set 35 ms
'dynamic' get 18 ms
Reflection set 162 ms
Reflection get 104 ms
Fasterflect set 205 ms
Fasterflect get 189 ms
Fasterflect cached set 11 ms
Fasterflect cached get 7 ms

Static Field Access

Tests 2000000 iterations
Direct set 2 ms
Direct get 3 ms
Reflection set 208 ms
Reflection get 165 ms
Fasterflect set 205 ms
Fasterflect get 216 ms
Fasterflect cached set 12 ms
Fasterflect cached get 14 ms

Property Access

Tests 2000000 iterations
Direct set 4 ms
Direct get 3 ms
'dynamic' set 43 ms
'dynamic' get 41 ms
Reflection set 415 ms
Reflection get 274 ms
Fasterflect set 212 ms
Fasterflect get 217 ms
Fasterflect cached set 15 ms
Fasterflect cached get 12 ms

Static Property Access

Tests 2000000 iterations
Direct set 3 ms
Direct get 3 ms
Reflection set 392 ms
Reflection get 283 ms
Fasterflect set 211 ms
Fasterflect get 199 ms
Fasterflect cached set 12 ms
Fasterflect cached get 11 ms

Method Invocation

Tests 2000000 iterations
Direct invoke 3 ms
Direct invoke (arg) 3 ms
'dynamic' invoke 29 ms
'dynamic' invoke (arg) 32 ms
Reflection invoke 217 ms
Reflection invoke (arg) 395 ms
Fasterflect invoke 233 ms
Fasterflect invoke (arg) 246 ms
Fasterflect cached invoke 8 ms
Fasterflect cached invoke (arg) 9 ms

Static Method Invocation

Tests 2000000 iterations
Direct invoke 3 ms
Direct invoke (arg) 3 ms
Reflection invoke 188 ms
Reflection invoke (arg) 374 ms
Fasterflect invoke 205 ms
Fasterflect invoke (arg) 249 ms
Fasterflect cached invoke 6 ms
Fasterflect cached invoke (arg) 8 ms

Indexer Access

Tests 2000000 iterations
Direct set 3 ms
Direct get 3 ms
'dynamic' set 32 ms
'dynamic' get 38 ms
Reflection set 646 ms
Reflection get 520 ms
Fasterflect set 373 ms
Fasterflect get 340 ms
Fasterflect cached set 44 ms
Fasterflect cached get 43 ms

Array Element Access

Tests 2000000 iterations
Direct set 3 ms
Direct get 3 ms
Reflection set 32 ms
Reflection get 31 ms
Fasterflect set 36 ms
Fasterflect get 34 ms
Fasterflect cached set 14 ms
Fasterflect cached get 12 ms

Access Methods Enabled via .NET Reflection Metadata

Tests 2000000 iterations
--- Static Method 2 ms
Direct static invoke 3 ms
Direct static invoke (arg) 3 ms
Reflection static invoke 188 ms
Reflection static invoke (arg) 337 ms
Fasterflect static invoke 200 ms
Fasterflect static invoke (arg) 309 ms

Metadata Lookup

Tests 2000000 iterations
--- Fields 3 ms
Reflection GetField 75 ms
Fasterflect Field 88 ms
Reflection GetFields 167 ms
Fasterflect Fields 257 ms
Fasterflect Fields+1 409 ms
Fasterflect Fields+5 622 ms
--- Properties 4 ms
Reflection GetProperty 108 ms
Fasterflect Property 104 ms
Reflection GetProperties 184 ms
Fasterflect Properties 265 ms
Fasterflect Properties+1 477 ms
Fasterflect Properties+5 519 ms
--- Members 3 ms
Reflection GetMember 929 ms
Fasterflect Member 1038 ms
Reflection GetMembers 1493 ms
Fasterflect Members 1508 ms
Fasterflect Members+1 2420 ms
Fasterflect Members+5 2973 ms
--- Methods 3 ms
Reflection GetMethod 427 ms
Fasterflect Method 450 ms
Reflection GetMethods 596 ms
Fasterflect Methods 469 ms
Fasterflect Methods+1 1325 ms
Fasterflect Methods+2 1201 ms
Fasterflect Methods+1+1 1199 ms
Fasterflect Members M 685 ms
--- Constructors 3 ms
Reflection GetConstructor 100 ms
Fasterflect Constructor 101 ms
Reflection GetConstructors 136 ms
Fasterflect Constructors 141 ms