Skip to content

Performance Reflection Performance

github-actions[bot] edited this page May 8, 2026 · 9 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-05-08 04:08:17 UTC

Strategy: Default (auto)

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 23.81M 4.99M 4.77x
Instance Field Set (boxed) 23.25M 5.47M 4.25x
Static Field Get (boxed) 23.45M 8.68M 2.70x
Static Field Set (boxed) 23.68M 5.56M 4.26x
Instance Property Get (boxed) 23.64M 22.38M 1.06x
Instance Property Set (boxed) 20.22M 1.96M 10.29x
Static Property Get (boxed) 18.00M 19.96M 0.90x
Static Property Set (boxed) 20.67M 2.90M 7.11x
Instance Method Invoke (boxed) 14.26M 2.01M 7.10x
Static Method Invoke (boxed) 19.86M 2.73M 7.27x
Constructor Invoke (boxed) 18.76M 2.60M 7.23x

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) 682.40M 672.50M 4.99M 1.01x 136.65x
Instance Field Set (typed) 655.28M 666.57M 5.47M 0.98x 119.89x
Static Field Get (typed) 662.61M 704.40M 8.68M 0.94x 76.35x
Static Field Set (typed) 666.25M 673.08M 5.56M 0.99x 119.78x
Instance Property Get (typed) 682.28M 691.91M 22.38M 0.99x 30.49x
Instance Property Set (typed) 618.65M 699.50M 1.96M 0.88x 315.03x
Static Property Get (typed) 670.50M 691.80M 19.96M 0.97x 33.59x
Static Property Set (typed) 653.06M 663.93M 2.90M 0.98x 224.83x
Instance Method Invoke (typed) 641.83M 687.16M 2.01M 0.93x 319.63x
Static Method Invoke (typed) 660.03M 687.85M 2.73M 0.96x 241.58x

Strategy: Expressions

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 18.84M 3.12M 6.04x
Instance Field Set (boxed) 1.90M 5.46M 0.35x
Static Field Get (boxed) 23.16M 8.68M 2.67x
Static Field Set (boxed) 21.85M 6.17M 3.54x
Instance Property Get (boxed) 20.84M 19.82M 1.05x
Instance Property Set (boxed) 21.13M 2.05M 10.31x
Static Property Get (boxed) 16.07M 19.55M 0.82x
Static Property Set (boxed) 21.60M 2.90M 7.46x
Instance Method Invoke (boxed) 16.21M 1.97M 8.21x
Static Method Invoke (boxed) 19.85M 2.73M 7.27x
Constructor Invoke (boxed) 21.50M 2.61M 8.23x

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) 680.40M 701.15M 3.12M 0.97x 218.25x
Instance Field Set (typed) 651.97M 670.03M 5.46M 0.97x 119.51x
Static Field Get (typed) 656.65M 704.16M 8.68M 0.93x 75.65x
Static Field Set (typed) 695.48M 667.70M 6.17M 1.04x 112.79x
Instance Property Get (typed) 688.73M 700.55M 19.82M 0.98x 34.76x
Instance Property Set (typed) 625.16M 711.76M 2.05M 0.88x 305.00x
Static Property Get (typed) 666.70M 693.34M 19.55M 0.96x 34.11x
Static Property Set (typed) 651.20M 664.29M 2.90M 0.98x 224.90x
Instance Method Invoke (typed) 639.52M 692.53M 1.97M 0.92x 323.96x
Static Method Invoke (typed) 661.92M 685.72M 2.73M 0.97x 242.33x

Strategy: Dynamic IL

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 22.39M 7.23M 3.09x
Instance Field Set (boxed) 22.97M 5.44M 4.22x
Static Field Get (boxed) 23.13M 8.62M 2.68x
Static Field Set (boxed) 21.14M 3.73M 5.66x
Instance Property Get (boxed) 21.67M 21.01M 1.03x
Instance Property Set (boxed) 21.50M 2.04M 10.52x
Static Property Get (boxed) 19.17M 4.00M 4.79x
Static Property Set (boxed) 1.46M 2.14M 0.68x
Instance Method Invoke (boxed) 17.48M 1.99M 8.76x
Static Method Invoke (boxed) 22.05M 2.76M 8.00x
Constructor Invoke (boxed) 21.97M 2.60M 8.45x

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) 674.63M 671.86M 7.23M 1.00x 93.25x
Instance Field Set (typed) 650.59M 666.95M 5.44M 0.98x 119.54x
Static Field Get (typed) 664.67M 705.04M 8.62M 0.94x 77.15x
Static Field Set (typed) 668.36M 666.33M 3.73M 1.00x 179.07x
Instance Property Get (typed) 685.34M 696.24M 21.01M 0.98x 32.62x
Instance Property Set (typed) 624.44M 703.63M 2.04M 0.89x 305.67x
Static Property Get (typed) 666.45M 693.56M 4.00M 0.96x 166.47x
Static Property Set (typed) 649.92M 663.82M 2.14M 0.98x 303.92x
Instance Method Invoke (typed) 628.36M 687.84M 1.99M 0.91x 315.12x
Static Method Invoke (typed) 661.83M 685.32M 2.76M 0.97x 240.04x

Strategy: Reflection Fallback

Boxed Access (object)

Scenario Helper (ops/sec) System.Reflection (ops/sec) Speedup vs Reflection
Instance Field Get (boxed) 7.47M 7.34M 1.02x
Instance Field Set (boxed) 3.57M 5.40M 0.66x
Static Field Get (boxed) 8.75M 8.61M 1.02x
Static Field Set (boxed) 3.65M 6.16M 0.59x
Instance Property Get (boxed) 18.75M 19.68M 0.95x
Instance Property Set (boxed) 2.07M 2.06M 1.00x
Static Property Get (boxed) 13.46M 19.11M 0.70x
Static Property Set (boxed) 2.80M 2.89M 0.97x
Instance Method Invoke (boxed) 1.96M 2.00M 0.98x
Static Method Invoke (boxed) 2.72M 2.72M 1.00x
Constructor Invoke (boxed) 1.80M 1.97M 0.91x

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) 7.47M 671.96M 7.34M 0.01x 1.02x
Instance Field Set (typed) 5.40M 666.41M 5.40M 0.01x 1.00x
Static Field Get (typed) 8.74M 704.42M 8.61M 0.01x 1.02x
Static Field Set (typed) 4.23M 668.03M 6.16M 0.01x 0.69x
Instance Property Get (typed) 683.71M 697.33M 19.68M 0.98x 34.73x
Instance Property Set (typed) 625.56M 704.49M 2.06M 0.89x 303.34x
Static Property Get (typed) 653.67M 693.08M 19.11M 0.94x 34.20x
Static Property Set (typed) 672.77M 663.41M 2.89M 1.01x 233.07x
Instance Method Invoke (typed) 640.56M 688.12M 2.00M 0.93x 320.73x
Static Method Invoke (typed) 663.79M 685.82M 2.72M 0.97x 244.25x

macOS

No benchmark data generated yet.

Linux

No benchmark data generated yet.

Unknown / Other

No benchmark data generated yet.

Clone this wiki locally