Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-92546: Move pprint benchmark into pyperformance #94613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 0 additions & 16 deletions 16 Lib/pprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,19 +637,6 @@ def _recursion(object):
% (type(object).__name__, id(object)))


def _perfcheck(object=None):
import time
if object is None:
object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000
p = PrettyPrinter()
t1 = time.perf_counter()
p._safe_repr(object, {}, None, 0, True)
t2 = time.perf_counter()
p.pformat(object)
t3 = time.perf_counter()
print("_safe_repr:", t2 - t1)
print("pformat:", t3 - t2)

def _wrap_bytes_repr(object, width, allowance):
current = b''
last = len(object) // 4 * 4
Expand All @@ -666,6 +653,3 @@ def _wrap_bytes_repr(object, width, allowance):
current = candidate
if current:
yield repr(current)

if __name__ == "__main__":
_perfcheck()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
An undocumented ``python -m pprint`` benchmark is moved into ``pprint``
suite of pyperformance. Patch by Oleg Iarygin.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.