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``.