Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    K

    Kornel Lesiński

    kornel.ski · Personal blog · on HN since 2016

    Kornel Lesiński, a developer of image compression tools, writes about Rust versus C speed, GIF and image compression, and fair image comparison.

    Visit blogHN submissions
    Systems & PerformanceProgrammingDesign & UX
    What HN says

    HN links it for lossy GIF tooling and his fair-comparison guide, which one commenter uses to dispute a benchmark with unequal file sizes.

    Stats for nerds
    17HN people shared it
    11linked in comments
    895story points
    Apr 2022last shared
    2016people per year2022

    Top posts on HN

    1. 1
      Speed of Rust vs. C
      5 people · 702 points · first shared 2020 · 525 comments on HN
    2. 2
      Lossy GIF compressor
      4 people · 152 points · first shared 2017 · 72 comments on HN
    3. 3
      How to Compare Images Fairly (2017)
      5 people · 32 points · first shared 2017 · 7 comments on HN
    4. 4
      Deringing in DCT via overshoot and clipping
      3 people · 4 points · first shared 2016 · Discussion on HN
    5. 5
      Using C libraries in Rust: how to make a sys crate
      1 person · 3 points · first shared 2018 · Discussion on HN
    6. 6
      AnimGIFs Need a Better Codec
      2 people · 2 points · first shared 2017 · 1 comments on HN
    7. 7
      Proxies
      1 person · first shared 2016
    8. 8
      Phpns
      1 person · first shared 2020

    What HN people wrote when they linked it

    • cutetyOct 2020

      Also, unfamiliar with PHP, but a few years ago I somehow ended up maintaining/managing one or two reasonably trafficked Wordpress sites that some (untechnical) friends put together, so every now again I get to learn how weird some shit in PHP is. And it’s that time again, because the comment about name conflicts was confusing as I could’ve sworn that during couple times I’ve had to actually poke around PHP code I saw it had namespaces. After some quick googling though, I was able to confirm a) PHP has “namespaces” and b) they seem to work like most other “features” (i.e. not like you’d expect if you’ve programmed in anything but PHP) [1].

      However, C has the a similar convention [2] (though the convention is — as far as I’m aware — for the sake of maintainability/readability as the compiler has no problem telling the difference between to things named the same, the person reading it probably will. While, as I understand it, PHP will just overwrite anything with the same name in the file/lib you include).

      It seems like PHP is heading in the right direction, but I have no idea why anyone would pick it up or start anything new with it these days, I don’t care how well done and the nice and new stuff is, it’s the decade of utter mess it’s built on top of that has uninterested me. Don’t get me wrong, since “acquiring” the Wordpress sites I’ve gone from a blind PHP hater, to at least understanding/appreciating it (but still won’t actually touch it with a 10ft pole). PHP is brain…

    • thebostikJun 2017

      (author here), It wasn't available when I started this project. butteraugli was (which guetzli uses internally), but in my opinion they're relatively new and need a bit more rigorous review than I can provide. I ultimately chose SSIM not because it was the most accurate metric in all cases, there have been plenty of advancements since it was published. But I linked a paper comparing several alternatives and saw that SSIM works fine for this use case (all things equal except number of JPEG artifacts), while being much faster, and that was enough proof for me to keep it simple.

      In a batch scenario today, one of these could make sense instead of SSIM and/or mozjpeg, but definitely do your own comparisons at equivalent file sizes, required reading: https://kornel.ski/en/faircomparison

      We do set a pretty high lower bound to avoid the edge cases inherent in the algorithm and as a result, out of the 30% savings, dynamic quality was only a small portion of that. I wouldn't be surprised that with an offline workload, a more CPU-intensive algorithm can do much better with a lower lower bound.

      I found that SSIM scores for images were relatively stable across resolution (same general graph shape, just translated down on the Y-axis). This is mentioned at line 36 of the example dynamic quality code. So we actually generate, compute and compare the SSIMs on much lower resolution candidate images than the final image for speed as well. I'm not sure if this would hold true for something…

    • samhwApr 2022

      I agree that the parent claim ("Rust will quickly replace C in the Linux kernel") was utterly risible, but your comments just seem like the mirror image of theirs. What on earth is an 'impostor language'? Imposture of what or whom?

      I'm tired of having to deal with this culture war crap in our profession. These languages are tools. C, C++, and Rust all compile down to the same LLVM IR (or GCC if you stray from rustc). There are certainly semantic and grammatical peculiarities that affect how each of them do so[0], but by and large running a simple Rust program and a simple C program through Godbolt will do a lot to disabuse you of the idea that the two are irreconcilably different.

      To anyone else who wants to write performant Rust, my advice: (1) no_std, if only to focus the mind, (2) .try_foo(), not .foo(), b/c allocation is fallible, (3) always set `opt-level` to at least 1 (1 is far further from 0 than 3 is from 1, ime), (4) use stack-allocated alternatives to heap-allocated types ('smallvec' or equiv vs Vec, 'smolstr' vs String, &c) even at the expense of overallocating buffer space, (5) exploit vectorisation where possible (e.g. SIMD), in general practising mechanical sympathy, and (5) parallelism is not a panacea, whereas cache locality usually is. Measure everything, but also: memorise every instruction and how many cycles it takes, and think in those terms - in terms of your assembled, perhaps-handmodified code - rather than unscientific laptop benchmarks. (Jeff…

    • pornelMar 2017

      Hard to find any. It's a primitive format ignoring 20 years of video compression research. It tries to be replacement for GIF by repeating its mistakes: it has very basic inter-frame compression, lacks motion vectors, doesn't guarantee keyframes, RGB-only, and frame decoding isn't parallelizable.

      In 8-bit mode it supports even fewer colors than GIF (GIF can combine frames to achieve thousands of colors), and in 24-bit mode it's larger than GIF.

      For full-motion video it requires 10x-15x more data than VP9 to be decompressed by the CPU, and there's no hardware acceleration.

      https://kornel.ski/efficient-gifs

      There's false dichotomy between "animations" and "videos", mostly due to historical reasons and that older codecs (and AWebP) used 4:2:0 subsampling which made them blurry. VP9 supports alpha, 4:4:4 mode, and it's cheaper to decode (it's more complex, but using 10x less data offsets that), so it'd be best to forget that GIF and APNG ever existed.

    • acdhaAug 2016

      The most common implementation of this appears to be from a company called Bytemobile which also injects some pretty buggy JavaScript into HTML content.

      The good news is that you can disable all of their degradation by adding "no-transform" to your Cache-Control headers:

      https://kornel.ski/en/proxies

      “The standard HTTP header Cache-Control: no-transform which tells proxies not to modify responses was respected by all proxies I've encountered. This is amazing! It wins an award in the "Best Supported Obscure Header" category.”

    • lossygifMay 2020

      http://www.lcdf.org/gifsicle/
      https://kornel.ski/lossygif

      you can also just compress user uploaded gifs serverside. but the top commenter is right, gifs are great because of they're functionality and simplicity.

      the better thing would be for the w3c and browsers vendors can get their act together (spoiler: they won't) and do things like make gif20, finish svg2, implement svgfonts, implement complete css3 specs, if you want to preserve functionality and usabilty of graphic assets on the web while reducing their bandwidth.

    Related

    Niko Matsakissmallcultfollowing.com221 people

    Towards a Rust Foundation

    Niko Matsakis
    Personal · last shared 2026
    matkladmatklad.github.io237 people

    Architecture.md

    matklad
    Personal · last shared 2026
    Kobzolkobzol.github.io40 people

    Rust compiler performance

    Kobzol
    Personal · last shared 2026
    Rust Blogblog.rust-lang.org533 people

    Announcing Rust 1.0

    Rust Blog
    Company · last shared 2026
    Patrick Waltonpcwalton.github.io53 people

    Pathfinder, a fast GPU-based font rasterizer in Rust

    Patrick Walton
    Personal · last shared 2025
    Surmasurma.dev67 people

    Ditherpunk: The article I wish I had about monochrome image dithering

    Surma
    Personal · last shared 2025
    Manish Goregaokarmanishearth.github.io97 people

    Picking Apart the Crashing iOS String

    Manish Goregaokar
    Personal · last shared 2026
    Codec Multimedia Blogcodecs.multimedia.cx20 people

    Rust: Not So Great For Codec Implementing

    Codec Multimedia Blog
    Personal · last shared 2025