Skip to content

Commit ae8f67c

Browse files
committed
set default level to 4
1 parent eaef3cb commit ae8f67c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/auditwheel/tools.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
logger = logging.getLogger(__name__)
1616

17+
# 4 has similar compress rate with the default level 6
18+
# while have ~35% speedup
19+
_COMPRESS_LEVEL = 4
20+
1721

1822
def unique_by_index(sequence: Iterable[_T]) -> list[_T]:
1923
"""unique elements in `sequence` in the order in which they occur
@@ -141,15 +145,12 @@ def dir2zip(in_dir: Path, zip_fname: Path, date_time: datetime | None = None) ->
141145
z.writestr(zinfo, b"")
142146
for file in files:
143147
fname = dname / file
144-
compress_level = None
145-
if is_lib(fname):
146-
compress_level = 2
147148
out_fname = fname.relative_to(in_dir)
148149
zinfo = zipfile.ZipInfo.from_file(fname, out_fname)
149150
zinfo.date_time = date_time_args
150151
zinfo.compress_type = compression
151152
with open(fname, "rb") as fp:
152-
z.writestr(zinfo, fp.read(), compresslevel=compress_level)
153+
z.writestr(zinfo, fp.read(), compresslevel=_COMPRESS_LEVEL)
153154
logger.info(f"dir2zip from {in_dir} to {zip_fname} takes {datetime.now() - start}")
154155

155156

0 commit comments

Comments
 (0)