Package: mmdebstrap
Version: 0.7.3-1
Severity: normal
File: /usr/bin/mmtarfilter
X-Debbugs-Cc: j...@joshtriplett.org

With a large number of path exclusions specified (around 500),
mmtarfilter starts to become a noticeable performance bottleneck.

It looks like mmtarfilter checks each file linearly against each filter
using fnmatch.

Python's fnmatch implementation works by translating shell patterns into regular
expressions. Python also provides a function to do that translation
separate from fnmatch. One fairly simple optimization would be to walk the list 
of
patterns *once*, take each series of consecutive exclude or include
filters, turn each one into a regex, join all the regexes in
each group together using (?:...)|(?:...) , and compile the resulting
regexes once. That should provide a substantial performance improvement.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.9.0-5-amd64 (SMP w/4 CPU threads)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mmdebstrap depends on:
ii  apt      2.1.15
ii  perl     5.32.0-6
ii  python3  3.9.1-1

Versions of packages mmdebstrap recommends:
pn  arch-test            <none>
pn  fakechroot           <none>
ii  fakeroot             1.25.3-1.1
ii  gpg                  2.2.20-1
pn  libdistro-info-perl  <none>
ii  mount                2.36.1-4
pn  uidmap               <none>

Versions of packages mmdebstrap suggests:
ii  apt [apt-transport-https]  2.1.15
pn  apt-transport-tor          <none>
ii  apt-utils                  2.1.15
pn  binfmt-support             <none>
ii  ca-certificates            20200601
ii  debootstrap                1.0.123
ii  distro-info-data           0.45
ii  dpkg-dev                   1.20.5
pn  perl-doc                   <none>
pn  proot                      <none>
pn  qemu-user                  <none>
pn  qemu-user-static           <none>
pn  squashfs-tools-ng          <none>

-- no debconf information

Reply via email to