Fax/PDF performance regression compared to focal

Bug #1992228 reported by Stephan Walter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
imagemagick (Ubuntu)
Triaged
High
Unassigned
Jammy
Triaged
High
Unassigned
Kinetic
Won't Fix
High
Unassigned

Bug Description

I'm regularly using `convert` to turn a line-art PNM file to a PDF with Fax/Group4 compression.

This used to take a few seconds on focal.

I updated to jammy and it takes almost 5 minutes now!

$ time convert -verbose scan.pnm -compress Fax scan.pdf
scan.pnm PBM 5120x7138 5120x7138+0+0 1-bit Bilevel Gray 4.35672MiB 0.610u 0:00.487
scan.pnm=> GROUP4 5120x7138 5120x7138+0+0 1-bit Gray 124981B 284.590u 4:43.594
scan.pnm=> GROUP4 5120x7138=>76x106 76x106+0+0 1-bit Gray 242B 0.150u 0:00.134
scan.pnm=>scan.pdf PBM 5120x7138 5120x7138+0+0 1-bit Bilevel Gray 127042B 285.280u 4:44.267

real 4m44.795s
user 2m5.962s
sys 2m39.970s

Input image here: https://stephan.walter.name/files/scan.pnm

I tried to reproduce the issue with upstream https://github.com/ImageMagick/ImageMagick6 , but the PDF file generated was just noise - I'm probably missing some `configure` options or libraries.

Changed in imagemagick (Ubuntu Jammy):
status: New → Triaged
Changed in imagemagick (Ubuntu Kinetic):
status: New → Triaged
Changed in imagemagick (Ubuntu Jammy):
importance: Undecided → Medium
Changed in imagemagick (Ubuntu Kinetic):
importance: Undecided → High
Changed in imagemagick (Ubuntu Jammy):
importance: Medium → High
tags: added: foundations-triage-discuss
Lukas Märdian (slyon)
tags: removed: foundations-triage-discuss
Revision history for this message
Julian Andres Klode (juliank) wrote :

Stephan: My suggestion would be to try to reproduce this upstream and file an issue with them so this can get fixed, as this is a community-maintained package.

Revision history for this message
Sebastien Bacher (seb128) wrote :

if it helps for testing upstream the package build option are defined there, https://salsa.debian.org/debian/imagemagick/-/blob/master/debian/rules#L70

Revision history for this message
Stephan Walter (stephan-walter) wrote :
Download full text (6.6 KiB)

Thanks to Sebastien and Julian for the hints. There seem to have been some performance variation in upstream around 6.9.10...6.9.11, but never quite as bad as the Ubuntu package.

Steps taken:

$ sudo apt-get build-dep imagemagick-6.q16
$ git clone https://github.com/ImageMagick/ImageMagick6.git
$ cd ImageMagick6
$ git checkout 6.9.11-60
$ ./configure --prefix=/usr/local/stow/ImageMagick6 --with-modules --with-gs-font-dir=/usr/share/fonts/type1/gsfonts -with-magick-plus-plus --with-djvu --with-heic --with-openjp2 --with-webp --with-wmf --without-gvc --without-dps --without-fpx --with-perl --without-rsvg --with-fftw
$ make
$ sudo make install
$ cd /usr/local/stow
$ sudo stow ImageMagick6
$ sudo ldconfig
$ cd ~
$ time /usr/local/bin/convert -version scan.pnm -compress Fax scan-upstream.pdf
Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-24 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib

real 0m10.906s
user 0m11.559s
sys 0m0.829s

This is slower than I had on Focal, I believe it was around 5 seconds but I don't have measurements. Unstow it and I'm back at 4m44s:

$ cd /usr/local/stow
$ sudo stow -D ImageMagick6
$ sudo ldconfig
$ cd ~
$ time /usr/bin/convert -version scan.pnm -compress Fax scan-ubuntu.pdf
Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib

real 4m43.623s
user 2m6.014s
sys 2m38.471s
$ ls -la scan-*.pdf
-rw-rw-r-- 1 i i 127070 Okt 15 16:35 scan-ubuntu.pdf
-rw-rw-r-- 1 i i 127046 Okt 15 16:29 scan-upstream.pdf

Configuring the package resulted in the following:

==============================================================================
ImageMagick 6.9.11-60 is configured as follows. Please verify that this
configuration matches your expectations.

Host system type: x86_64-pc-linux-gnu
Build system type: x86_64-pc-linux-gnu

                  Option Value
------------------------------------------------------------------------------
Shared libraries --enable-shared=yes yes
Static libraries --enable-static=yes yes
Module support --with-modules=yes yes
GNU ld --with-gnu-ld=yes yes
Quantum depth --with-quantum-depth=16 16
High Dynamic Range Imagery
                  --enable-hdri=no no

Install documentation: yes

Memory allocation library:
  JEMalloc --with-jemalloc=no no
  TCMalloc --with-tcmalloc=no no
  UMem --with-umem=no no

Delegate library configuration:
  BZLIB --with-bzlib=yes yes
  Autotrace --with-autotrace=no no
  DJVU --with-djvu=yes yes
  DPS --with-dps=no no
  FFTW --with-fftw=yes yes
  FLI...

Read more...

Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Ubuntu 22.10 (Kinetic Kudu) has reached end of life, so this bug will not be fixed for that specific release.

Changed in imagemagick (Ubuntu Kinetic):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.