From a8da92539a4f163ed1e7888991da68ba6a420e1e Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Wed, 6 Jul 2022 21:01:54 +0300 Subject: [PATCH 1/4] Move `pprint` benchmark into pyperformance --- Lib/pprint.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Lib/pprint.py b/Lib/pprint.py index 575688d8eb6f4a..34ed12637e2288 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -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 @@ -666,6 +653,3 @@ def _wrap_bytes_repr(object, width, allowance): current = candidate if current: yield repr(current) - -if __name__ == "__main__": - _perfcheck() From fe023ff28622312553c0780c37ed445b23de9761 Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Wed, 6 Jul 2022 21:24:20 +0300 Subject: [PATCH 2/4] Add a NEWS entry --- .../next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst diff --git a/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst b/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst new file mode 100644 index 00000000000000..cc83164887531b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst @@ -0,0 +1,2 @@ +An undocumented ``python -m pprint`` benchmark is moved into ``from_stdlib`` +suit of pyperformance. Patch by Oleg Iarygin. From f7bc3395c14b0d80c4ac21332ee89c765e76e2ca Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Fri, 8 Jul 2022 09:20:42 +0300 Subject: [PATCH 3/4] Address Shantanu's review Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> --- .../next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst b/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst index cc83164887531b..9e648cc104f56e 100644 --- a/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst +++ b/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst @@ -1,2 +1,2 @@ An undocumented ``python -m pprint`` benchmark is moved into ``from_stdlib`` -suit of pyperformance. Patch by Oleg Iarygin. +suite of pyperformance. Patch by Oleg Iarygin. From 338145317978de5ccc046c765b8ac1af8b182b76 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 25 Jul 2022 12:05:42 -0600 Subject: [PATCH 4/4] Update Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst --- .../next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst b/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst index 9e648cc104f56e..0ea676ef5b0d8d 100644 --- a/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst +++ b/Misc/NEWS.d/next/Library/2022-07-06-21-24-03.gh-issue-92546.s5Upkh.rst @@ -1,2 +1,2 @@ -An undocumented ``python -m pprint`` benchmark is moved into ``from_stdlib`` +An undocumented ``python -m pprint`` benchmark is moved into ``pprint`` suite of pyperformance. Patch by Oleg Iarygin.