Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyperformance/data-files/benchmarks/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ django_template <local>
dulwich_log <local>
fannkuch <local>
float <local>
from_stdlib <local>
genshi <local>
go <local>
hexiom <local>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[project]
name = "pyperformance_bm_from_stdlib"
requires-python = ">=3.8"
dependencies = ["pyperf"]
urls = {repository = "https://github.com/python/pyperformance"}
dynamic = ["version"]

[tool.pyperformance]
name = "from_stdlib"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Various benchmarks previously stored inside the Python stdlib.

Ported here by Oleg Iarygin.
"""

import pyperf


def benchmark_pprint(runner):
"""Moved from `python -m pprint`."""
from pprint import PrettyPrinter
printable = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100_000
p = PrettyPrinter()

runner.bench_func('_safe_repr', p._safe_repr, printable, {}, None, 0)
runner.bench_func('pformat', p.pformat, printable)


if __name__ == "__main__":
runner = pyperf.Runner()
cmd = runner.argparser

args = runner.parse_args()
benchmark_pprint(runner)