Skip to content

ToStringEx benchmarks

Michael Lidgren edited this page Jan 27, 2021 · 2 revisions

See enums used here. Code to produce this benchmark is here.

Note; Lidgren_SimpleEnum with a constant enum value did in fact produce a constant return value, so no-op; but the test was changed to a variable enum in the chart below.

Method Mean Error StdDev Median Ratio RatioSD Gen 0 Allocated
Core_SimpleEnum 25.4141 ns 0.1378 ns 0.1289 ns 25.4311 ns 1.000 0.00 0.0057 24 B
EnumsNET_SimpleEnum 2.1029 ns 0.0108 ns 0.0090 ns 2.1051 ns 0.083 0.00 - -
FastEnum_SimpleEnum 2.7236 ns 0.0075 ns 0.0059 ns 2.7227 ns 0.107 0.00 - -
Lidgren_SimpleEnum 0.2332 ns 0.0095 ns 0.0084 ns 0.2331 ns 0.009 0.00 - -
Core_OffsetDiscontinuousEnum 25.0412 ns 0.1363 ns 0.1275 ns 24.9862 ns 1.00 0.00 0.0057 24 B
EnumsNET_OffsetDiscontinuousEnum 1.9374 ns 0.0230 ns 0.0215 ns 1.9376 ns 0.08 0.00 - -
FastEnum_OffsetDiscontinuousEnum 2.6799 ns 0.0274 ns 0.0243 ns 2.6759 ns 0.11 0.00 - -
Lidgren_OffsetDiscontinuousEnum 1.6759 ns 0.0175 ns 0.0164 ns 1.6762 ns 0.07 0.00 - -
Core_FlagsEnum_Single 21.5874 ns 0.4588 ns 0.6725 ns 21.1972 ns 1.00 0.00 0.0057 24 B
EnumsNET_FlagsEnum_Single 1.8807 ns 0.0147 ns 0.0130 ns 1.8822 ns 0.09 0.00 - -
FastEnum_FlagsEnum_Single 2.5054 ns 0.0158 ns 0.0148 ns 2.5080 ns 0.11 0.00 - -
Lidgren_FlagsEnum_Single 2.5364 ns 0.0148 ns 0.0131 ns 2.5404 ns 0.12 0.00 - -
Core_FlagsEnum_Multi 40.9252 ns 0.2979 ns 0.2641 ns 40.8327 ns 1.00 0.00 0.0210 88 B
EnumsNET_FlagsEnum_Multi NA NA NA NA ? ? - -
FastEnum_FlagsEnum_Multi NA NA NA NA ? ? - -
Lidgren_FlagsEnum_Multi 42.5209 ns 0.1833 ns 0.1531 ns 42.5049 ns 1.04 0.01 0.0210 88 B
Clone this wiki locally