Skip to content

Performance Reflection Performance

github-actions[bot] edited this page Jan 26, 2026 · 6 revisions

Reflection Performance Benchmarks

Unity Helpers replaces ad-hoc reflection with cached delegates that favour expression lambdas on IL2CPP-safe platforms and fall back to dynamic IL emit or plain reflection where available. These benchmarks compare raw System.Reflection against the helpers for common access patterns.

Each run updates the table for the current operating system only. Sections that still show _No benchmark data generated yet._ simply have not been executed on that platform.

Windows

Generated on 2026-01-12 01:50:03 UTC

Strategy: Default (auto)

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 25.21M 6.69M 3.77x
Instance Field Set (boxed) 22.18M 5.50M 4.03x
Static Field Get (boxed) 16.53M 2.71M 6.09x
Static Field Set (boxed) 18.01M 4.92M 3.66x
Instance Property Get (boxed) 28.85M 25.19M 1.15x
Instance Property Set (boxed) 24.78M 1.49M 16.61x
Static Property Get (boxed) 21.82M 24.49M 0.89x
Static Property Set (boxed) 26.46M 2.54M 10.42x
Instance Method Invoke (boxed) 20.55M 1.71M 11.99x
Static Method Invoke (boxed) 25.30M 2.68M 9.42x
Constructor Invoke (boxed) 23.48M 2.52M 9.33x

Typed Access (no boxing)

Scenario Helper (ops/sec) Baseline Delegate (ops/sec) System.Reflection (ops/sec) Speedup vs Delegate Speedup vs Reflection
Instance Field Get (typed) 650.81M 661.45M 6.69M 0.98x 97.25x
Instance Field Set (typed) 653.34M 660.94M 5.50M 0.99x 118.80x
Static Field Get (typed) 663.07M 687.03M 2.71M 0.97x 244.39x
Static Field Set (typed) 681.63M 670.11M 4.92M 1.02x 138.44x
Instance Property Get (typed) 685.44M 692.09M 25.19M 0.99x 27.21x
Instance Property Set (typed) 661.24M 701.70M 1.49M 0.94x 443.26x
Static Property Get (typed) 652.49M 685.16M 24.49M 0.95x 26.64x
Static Property Set (typed) 677.05M 657.03M 2.54M 1.03x 266.65x
Instance Method Invoke (typed) 686.13M 685.59M 1.71M 1.00x 400.58x
Static Method Invoke (typed) 659.66M 678.18M 2.68M 0.97x 245.75x

Strategy: Expressions

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 24.78M 6.08M 4.07x
Instance Field Set (boxed) 28.58M 5.48M 5.21x
Static Field Get (boxed) 20.95M 8.51M 2.46x
Static Field Set (boxed) 27.73M 4.57M 6.06x
Instance Property Get (boxed) 21.15M 3.49M 6.06x
Instance Property Set (boxed) 12.82M 2.02M 6.34x
Static Property Get (boxed) 22.50M 20.45M 1.10x
Static Property Set (boxed) 20.66M 2.88M 7.17x
Instance Method Invoke (boxed) 23.90M 1.98M 12.08x
Static Method Invoke (boxed) 27.12M 2.21M 12.27x
Constructor Invoke (boxed) 27.01M 2.54M 10.65x

Typed Access (no boxing)

Scenario Helper (ops/sec) Baseline Delegate (ops/sec) System.Reflection (ops/sec) Speedup vs Delegate Speedup vs Reflection
Instance Field Get (typed) 692.43M 658.49M 6.08M 1.05x 113.81x
Instance Field Set (typed) 651.66M 657.97M 5.48M 0.99x 118.84x
Static Field Get (typed) 647.30M 683.07M 8.51M 0.95x 76.02x
Static Field Set (typed) 669.78M 656.50M 4.57M 1.02x 146.40x
Instance Property Get (typed) 676.92M 684.18M 3.49M 0.99x 194.03x
Instance Property Set (typed) 657.90M 691.31M 2.02M 0.95x 325.26x
Static Property Get (typed) 643.98M 684.71M 20.45M 0.94x 31.49x
Static Property Set (typed) 669.72M 653.78M 2.88M 1.02x 232.38x
Instance Method Invoke (typed) 680.33M 680.42M 1.98M 1.00x 343.95x
Static Method Invoke (typed) 653.83M 674.42M 2.21M 0.97x 295.69x

Strategy: Dynamic IL

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 27.70M 5.80M 4.77x
Instance Field Set (boxed) 28.24M 5.45M 5.18x
Static Field Get (boxed) 21.57M 8.41M 2.56x
Static Field Set (boxed) 25.65M 6.16M 4.17x
Instance Property Get (boxed) 18.83M 22.95M 0.82x
Instance Property Set (boxed) 25.31M 1.98M 12.80x
Static Property Get (boxed) 23.51M 8.69M 2.71x
Static Property Set (boxed) 2.06M 2.86M 0.72x
Instance Method Invoke (boxed) 23.09M 2.00M 11.56x
Static Method Invoke (boxed) 27.05M 2.12M 12.75x
Constructor Invoke (boxed) 26.10M 2.52M 10.36x

Typed Access (no boxing)

Scenario Helper (ops/sec) Baseline Delegate (ops/sec) System.Reflection (ops/sec) Speedup vs Delegate Speedup vs Reflection
Instance Field Get (typed) 662.00M 685.29M 5.80M 0.97x 114.09x
Instance Field Set (typed) 654.77M 661.50M 5.45M 0.99x 120.17x
Static Field Get (typed) 657.70M 683.29M 8.41M 0.96x 78.17x
Static Field Set (typed) 675.09M 659.39M 6.16M 1.02x 109.61x
Instance Property Get (typed) 673.39M 690.30M 22.95M 0.98x 29.34x
Instance Property Set (typed) 652.07M 693.53M 1.98M 0.94x 329.72x
Static Property Get (typed) 648.59M 682.82M 8.69M 0.95x 74.63x
Static Property Set (typed) 671.01M 654.32M 2.86M 1.03x 234.23x
Instance Method Invoke (typed) 690.97M 686.98M 2.00M 1.01x 345.91x
Static Method Invoke (typed) 660.09M 679.79M 2.12M 0.97x 311.08x

Strategy: Reflection Fallback

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 7.48M 5.76M 1.30x
Instance Field Set (boxed) 5.57M 5.47M 1.02x
Static Field Get (boxed) 7.71M 7.19M 1.07x
Static Field Set (boxed) 6.01M 6.13M 0.98x
Instance Property Get (boxed) 21.09M 18.38M 1.15x
Instance Property Set (boxed) 2.09M 2.06M 1.01x
Static Property Get (boxed) 20.07M 23.51M 0.85x
Static Property Set (boxed) 2.88M 2.02M 1.42x
Instance Method Invoke (boxed) 1.99M 1.98M 1.01x
Static Method Invoke (boxed) 2.69M 2.72M 0.99x
Constructor Invoke (boxed) 2.55M 2.50M 1.02x

Typed Access (no boxing)

Scenario Helper (ops/sec) Baseline Delegate (ops/sec) System.Reflection (ops/sec) Speedup vs Delegate Speedup vs Reflection
Instance Field Get (typed) 5.24M 662.95M 5.76M 0.01x 0.91x
Instance Field Set (typed) 5.46M 668.23M 5.47M 0.01x 1.00x
Static Field Get (typed) 8.64M 683.37M 7.19M 0.01x 1.20x
Static Field Set (typed) 4.77M 661.19M 6.13M 0.01x 0.78x
Instance Property Get (typed) 675.25M 683.53M 18.38M 0.99x 36.75x
Instance Property Set (typed) 655.22M 704.28M 2.06M 0.93x 317.56x
Static Property Get (typed) 652.21M 691.83M 23.51M 0.94x 27.75x
Static Property Set (typed) 678.92M 659.94M 2.02M 1.03x 335.95x
Instance Method Invoke (typed) 692.36M 685.00M 1.98M 1.01x 350.50x
Static Method Invoke (typed) 661.40M 678.90M 2.72M 0.97x 242.98x

macOS

No benchmark data generated yet.

Linux

No benchmark data generated yet.

Unknown / Other

No benchmark data generated yet.

Clone this wiki locally