Live data from Hacker News

Wuffs’ PNG image decoder

nigeltao.github.io

141–144 of 144 posts

Re: Wuffs’ PNG image decoder

#141

Earlier quoted context omitted.

> I'm curious if it is at all competitive with the Wuffs decoder You could try adapting https://github.com/google/wuffs/tree/main/script/bench-rust-... > https://github.com/bschwind/png-decoder Note that statements like: let bytes_per_scanline = ((header.width * header.bit_depth as u32 * header.color_type.sample_multiplier()) + 7) / 8; can silently overflow a u32 if width is 0x800_0000, bit_depth is 8 and sample_mult…

> You could try adapting ... Do you accept PRs for the Rust benchmarks? My code is nowhere near competitive to the Wuffs implementation, but it would be a fun goal to work towards. > Note that statements like ... can silently overflow a u32 Thank you for catching that, I'll go through the entire codebase and try to fix those up. That's a part of Rust that always makes me feel uneasy - the compiler will tell you if yo…

> Do you accept PRs for the Rust benchmarks?

Sure! I'll take a PR that adds script/bench-rust-png-decoder to the Wuffs repo.

I'll also take patches to script/bench-rust-png. I'm not as fluent in Rust as I am in C/C++ or Go, so I might easily be doing something silly there.

Re: Wuffs’ PNG image decoder

#142
post #124
post #113

Earlier quoted context omitted.

> I would particularly love it as an embedded language, rather than one needing a full-blown application. Given the existence of [0], I imagine this is doable. [0]: https://docs.rs/inline-python/0.6.0/inline_python/

That inline Python is the closest thing to black magic I've seen in a while. I guess I have to find an excuse to play around with Rust some time soon, it seems like such a cool ecosystem.

If you like that sort of thing you'll enjoy following the creater on twitter. Here's another of her creations

> Did you know you can just fork() the @rustlang compiler from your proc_macro?

> Unfortunately rustc is multithreaded and fork() only forks one thread. We'll just assume the other threads weren't doing anything important.

> In today's rustc, this means we're only missing the main thread in the fork. But that one was only going to call exit() after joining our thread anyway, so not very important. It just means the process always exits with a success status. So instead we grep the output for "error".

https://mobile.twitter.com/m_ou_se/status/136884418660735795...

Re: Wuffs’ PNG image decoder

#143
post #60

Looks good, but has somewhat widely false claims: > SMHasher is a test and benchmark suite for a variety of hash function implementations. It can provide data for claims like “our new Foo hash function is faster than the widely used Bar, Baz and Qux hash functions”. However, when comparing Foo to CRC-32, be aware that a SIMD-accelerated CRC-32 implementation can be 47x faster than SMHasher’s simple CRC-32 implementat…

> smhasher implements both Ah, I'm based on aappleby/smasher, which is what the original location ( http://code.google.com/p/smhasher ) redirects to. I didn't realize that you have a more active fork. > not just 47x faster, but 5000x faster It's 47x faster: https://github.com/rurban/smhasher/issues/189

Thanks a lot for detecting this bug! Nigel's numbers were right, mine were wrong

Re: Wuffs’ PNG image decoder

#144
post #47
post #17

Another tool along these lines is Galois' Ivory language https://ivorylang.org/ , a Haskell-embedded language for writing safe/reliable C.

You might be interested in cakeml and cogent. What Safety Integrity Level can ivory guarantee? level2?

CakeML is interesting, but I don't think any language can guarantee a SIL.
Post reply on HN