Skip to content

Commit c514094

Browse files
authored
gh-92546: Move pprint benchmark into pyperformance (GH-94613)
This PR couples with python/pyperformance#222 and supersedes #92560. Inspired by #93096 (comment). Automerge-Triggered-By: GH:ericsnowcurrently
1 parent 4e704d7 commit c514094

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

Lib/pprint.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -637,19 +637,6 @@ def _recursion(object):
637637
% (type(object).__name__, id(object)))
638638

639639

640-
def _perfcheck(object=None):
641-
import time
642-
if object is None:
643-
object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000
644-
p = PrettyPrinter()
645-
t1 = time.perf_counter()
646-
p._safe_repr(object, {}, None, 0, True)
647-
t2 = time.perf_counter()
648-
p.pformat(object)
649-
t3 = time.perf_counter()
650-
print("_safe_repr:", t2 - t1)
651-
print("pformat:", t3 - t2)
652-
653640
def _wrap_bytes_repr(object, width, allowance):
654641
current = b''
655642
last = len(object) // 4 * 4
@@ -666,6 +653,3 @@ def _wrap_bytes_repr(object, width, allowance):
666653
current = candidate
667654
if current:
668655
yield repr(current)
669-
670-
if __name__ == "__main__":
671-
_perfcheck()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
An undocumented ``python -m pprint`` benchmark is moved into ``pprint``
2+
suite of pyperformance. Patch by Oleg Iarygin.

0 commit comments

Comments
 (0)