Git Product home page Git Product logo

Comments (4)

tayloraswift avatar tayloraswift commented on May 26, 2024

can you share the test image?

have you tried configuring the compression level? keep in mind swift-png uses the highest compression setting by default, which is significantly more aggressive than libpng's maximum setting, so it's not surprising that it's very slow encoding, since it is optimizing for file size, not speed. the higher levels have diminishing returns, so dropping down to say, L5 or so should not severely increase the file size

from swift-png.

ospfranco avatar ospfranco commented on May 26, 2024

I see the same behavior, the PNG I'm using is just a screenshot from my desktop. It only happens on debug build though, on release it seems to be very speedy.

Screenshot 000804

I'm on a m2 air, on Monterrey 12.5

from swift-png.

philipcolejohnson avatar philipcolejohnson commented on May 26, 2024

I wanted to pop in late and say I'm also seeing this in v4.0.2, running on a M2 pro, Ventura 13.0.1.

I am using the compression level 0, which I assume is little to none. Release builds run this very quickly, but debug builds take nearly 2 seconds for a 1280x720 image. Here's what I am doing:

public func writePng(pngData: PNG.Data.Rectangular, to path: URL) throws {
    var pngFile: PngFile = .init(filePath: path)
    try pngData.compress(stream: &pngFile, level: 0)
}

Unfortunately, I am unable to share the images, as they are private. But here is where I'm seeing the CPU usage in the profiler:

CleanShot 2023-01-06 at 14 47 40@2x

from swift-png.

kellyo-cricut avatar kellyo-cricut commented on May 26, 2024

I'm encountering the same issue in 4.0.2/M1/Ventura 13.4.1 with 'normal' sized pngs (~100k, ~1000x1000). Profiling it shows most of the time is spent in the SIMD16 extension find function. Is there any work towards solving this or any suggestions for adjusting that call?

from swift-png.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.