From b4fe02f595fcb9f78261920a268ef614821ec195 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:24:24 -0700 Subject: [PATCH] gh-117205: Increase chunksize when compiling pyc in parallel (#117206) --- Lib/compileall.py | 3 ++- .../Library/2024-03-25-00-20-16.gh-issue-117205.yV7xGb.rst | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2024-03-25-00-20-16.gh-issue-117205.yV7xGb.rst diff --git a/Lib/compileall.py b/Lib/compileall.py index 9b53086bf41..47e2446356e 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -116,7 +116,8 @@ def compile_dir(dir, maxlevels=None, ddir=None, force=False, prependdir=prependdir, limit_sl_dest=limit_sl_dest, hardlink_dupes=hardlink_dupes), - files) + files, + chunksize=4) success = min(results, default=True) else: for file in files: diff --git a/Misc/NEWS.d/next/Library/2024-03-25-00-20-16.gh-issue-117205.yV7xGb.rst b/Misc/NEWS.d/next/Library/2024-03-25-00-20-16.gh-issue-117205.yV7xGb.rst new file mode 100644 index 00000000000..8d8c201afd2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-03-25-00-20-16.gh-issue-117205.yV7xGb.rst @@ -0,0 +1 @@ +Speed up :func:`compileall.compile_dir` by 20% when using multiprocessing by increasing ``chunksize``.