Skip to content

Instantly share code, notes, and snippets.

@RonnyPfannschmidt
Created February 14, 2021 19:58
Show Gist options
  • Save RonnyPfannschmidt/b0cd7a497bdfc69c1c72d8610acc4230 to your computer and use it in GitHub Desktop.
Save RonnyPfannschmidt/b0cd7a497bdfc69c1c72d8610acc4230 to your computer and use it in GitHub Desktop.
pytest benchmark example for impl compare
benchmarks | dataclass | attrs | zokusei
-------------------+------------------+----------------------+------------------
test_repr | 737.6109 (1.0) | 1,503.2417 (2.04) | 2,468.6994 (3.35)
test_make_instance | 320.6658 (1.01) | 317.8374 (1.0) | 831.7211 (2.62)
test_make_class | 238.7450 (19.83) | 4,727.8656 (392.77) | 12.0371 (1.0)
--------------------------------------------------------------------------------------- benchmark 'test_make_class': 3 tests ---------------------------------------------------------------------------------------
Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_make_class[zokusei] 10.0370 (1.0) 242.1020 (1.0) 12.0371 (1.0) 10.4810 (1.0) 10.4810 (1.0) 0.2210 (1.0) 642;3270 83,076.4419 (1.0) 35064 1
test_make_class[dataclass] 222.0170 (22.12) 7,378.8460 (30.48) 238.7450 (19.83) 138.4032 (13.21) 230.5839 (22.00) 5.6877 (25.73) 16;193 4,188.5693 (0.05) 3299 1
test_make_class[attrs] 246.4520 (24.55) 9,662.6710 (39.91) 4,727.8656 (392.77) 2,584.4594 (246.59) 4,688.4640 (447.33) 4,494.9880 (>1000.0) 1172;0 211.5119 (0.00) 2762 1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------ benchmark 'test_make_instance': 3 tests ------------------------------------------------------------------------------------
Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_make_instance[dataclass] 307.7512 (1.0) 14,688.1866 (9.60) 320.6658 (1.01) 68.0402 (2.28) 315.2527 (1.00) 7.6870 (1.10) 2909;3904 3.1185 (0.99) 197668 16
test_make_instance[attrs] 308.1259 (1.00) 1,530.2503 (1.0) 317.8374 (1.0) 29.7921 (1.0) 314.3141 (1.0) 6.9995 (1.0) 1926;2356 3.1463 (1.0) 195693 16
test_make_instance[zokusei] 795.3301 (2.58) 40,067.8352 (26.18) 831.7211 (2.62) 184.3376 (6.19) 827.1697 (2.63) 20.6637 (2.95) 1745;2785 1.2023 (0.38) 193461 6
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------- benchmark 'test_repr': 3 tests ----------------------------------------------------------------------------------------
Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_repr[dataclass] 691.7149 (1.0) 32,540.4274 (1.22) 737.6109 (1.0) 129.4517 (1.0) 729.2921 (1.0) 21.1460 (1.0) 3018;3336 1,355.7283 (1.0) 183589 7
test_repr[attrs] 1,386.0408 (2.00) 26,769.9943 (1.0) 1,503.2417 (2.04) 276.1161 (2.13) 1,474.9821 (2.02) 52.9690 (2.50) 1834;4003 665.2290 (0.49) 108590 1
test_repr[zokusei] 2,302.9861 (3.33) 237,241.0381 (8.86) 2,468.6994 (3.35) 1,264.5756 (9.77) 2,419.9835 (3.32) 61.0598 (2.89) 916;4367 405.0716 (0.30) 106361 1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment