Package: python3-matplotlib
Version: 1.4.2-3.1
Severity: normal
Since upgrading from Wheezy, the startup of matplotlib seems extremely
slow. Scripts that previously appeared to show results instantanously
now take multiple seconds until the first plot appears.
I tried debugging this with a very simple test script:
#!/usr/bin/env python3
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.show()
Looking at the strace output, I found a large number of seemingly
completely pointless lseek() calls. For example:
open("/usr/lib/python3.4/encodings/__pycache__/unicode_escape.cpython-34.pyc",
O_RDONLY|O_CLOEXEC) = 8
fstat(8, {st_mode=S_IFREG|0644, st_size=1842, ...}) = 0
lseek(8, 0, SEEK_CUR) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=1842, ...}) = 0
read(8,
"\356\f\r\n\240#5T\240\4\0\0\343\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0@\0\0"...,
1843) = 1842
read(8, "", 1) = 0
close(8) = 0
open("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", O_RDONLY|O_CLOEXEC) = 8
fstat(8, {st_mode=S_IFREG|0644, st_size=741536, ...}) = 0
ioctl(8, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
0x7ffe52ac0a90) = -1 ENOTTY (Inap
fstat(8, {st_mode=S_IFREG|0644, st_size=741536, ...}) = 0
lseek(8, 0, SEEK_CUR) = 0
fcntl(8, F_DUPFD_CLOEXEC, 0) = 9
fcntl(9, F_GETFL) = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(9, {st_mode=S_IFREG|0644, st_size=741536, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f5403f06000
lseek(9, 0, SEEK_CUR) = 0
lseek(8, 0, SEEK_CUR) = 0
lseek(9, 0, SEEK_SET) = 0
fstat(9, {st_mode=S_IFREG|0644, st_size=741536, ...}) = 0
lseek(9, 741376, SEEK_SET) = 741376
read(9, "+\0++++++++++++++++++++++++++++++"..., 160) = 160
lseek(9, 0, SEEK_SET) = 0
lseek(9, 0, SEEK_SET) = 0
lseek(9, 0, SEEK_SET) = 0
read(9, "\0\1\0\0\0\23\1\0\0\4\0000FFTMh\275QN\0\0\1<\0\0\0\34GDEF"..., 4096) =
4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
lseek(9, 4096, SEEK_SET) = 4096
[...]
Note that there are no other syscalls between the lseek() - Python simply
seeks to the same position over and over again. I am not 100% sure that
this is the cause of the slow-down, but it certainly looks like
something is wrong here.
$ strace -o log python3 test.py
$ grep lseek log | wc -l
1871
$ strace -o log python3 -c 'print("Hello")'
Hello
$ grep lseek log | wc -l
31
-- System Information:
Debian Release: 8.1
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages python3-matplotlib depends on:
ii libc6 2.19-18
ii libfreetype6 2.5.2-3
ii libgcc1 1:4.9.2-10
ii libjs-jquery 1.7.2+dfsg-3.2
ii libjs-jquery-ui 1.10.1+dfsg-1
ii libpng12-0 1.2.50-2+b2
ii libstdc++6 4.9.2-10
ii libtcl8.6 8.6.2+dfsg-2
ii libtk8.6 8.6.2-1
ii python-matplotlib-data 1.4.2-3.1
ii python3 3.4.2-2
ii python3-dateutil 2.2-2
ii python3-nose 1.3.4-1
ii python3-numpy [python3-numpy-abi9] 1:1.8.2-2
ii python3-pyparsing 2.0.3+dfsg1-1
ii python3-six 1.8.0-1
ii python3-tz 2012c+dfsg-0.1
Versions of packages python3-matplotlib recommends:
ii python3-pil 2.6.1-2
ii python3-tk 3.4.2-1+b1
Versions of packages python3-matplotlib suggests:
pn dvipng <none>
ii ghostscript 9.06~dfsg-2+deb8u1
ii gir1.2-gtk-3.0 3.14.5-1
ii inkscape 0.48.5-3
ii ipython3 2.3.0-2
ii librsvg2-common 2.40.5-1
ii python-matplotlib-doc 1.4.2-3.1
pn python3-cairocffi <none>
ii python3-gi [python3-gobject] 3.14.0-1
ii python3-gi-cairo 3.14.0-1
ii python3-pyqt4 4.11.2+dfsg-1
ii python3-scipy 0.14.0-2
ii python3-sip 4.16.4+dfsg-1
pn python3-tornado <none>
ii texlive-extra-utils 2014.20141024-1
ii texlive-latex-extra 2014.20141024-1
pn ttf-staypuft <none>
-- no debconf information