Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • gdk-pixbuf gdk-pixbuf
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 83
    • Issues 83
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gdk-pixbufgdk-pixbuf
  • Merge requests
  • !14

Speed up saving PNGs by skipping a null transform

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Brion Vibber (WMF) requested to merge bvibber/gdk-pixbuf:png-faster into master Sep 06, 2018
  • Overview 3
  • Commits 1
  • Pipelines 2
  • Changes 1

Calling png_set_shift to set the number of significant bits of input triggers a transform operation inside libpng which shifts bits around, even if it's a null operation of 8 bits to 8 bits.

I measured this slowdown as about 30% of total saving runtime on a large 7680x2160 screenshot.

In addition, only 8 bits per channel are supported in gdk-pixbuf so this is never actually needed in practice.

Fixes #90 (closed)

Measured improvement using the thumbnail helper (includes load time as well as save time):

before

$ jhbuild run time gdk-pixbuf-thumbnailer ~/src/png/png-squisher/data/dual-4k-sample.png -s 7680 out.png
2.55user 0.04system 0:02.61elapsed 99%CPU (0avgtext+0avgdata 72324maxresident)k

after

$ jhbuild run time gdk-pixbuf-thumbnailer ~/src/png/png-squisher/data/dual-4k-sample.png -s 7680 out.png
2.04user 0.04system 0:02.10elapsed 99%CPU (0avgtext+0avgdata 72236maxresident)k
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: png-faster