Surprisingly, Go's png decoder is half as slow as the default libpng :( https://nigeltao.github.io/blog/2021/fastest-safest-png-deco...
Wuffs’ PNG image decoder
81–90 of 144 posts
Re: Wuffs’ PNG image decoder
#82Interesting. First time I've head of Wuffs. As someone that still uses C, this in particular sounds neat: (from https://github.com/google/wuffs#goals-and-non-goals ) """ Wuffs' goal is to produce software libraries that are as safe as Go or Rust, roughly speaking, but as fast as C, and that can be used anywhere C libraries are used. [...] Wuffs the Library is available as transpiled C code. Other C/C++ projects can u…
Wuffs touts its lack of memory allocation as a safety feature [0]. Rust could add a `#![forbid(alloc)]` declaration and achieve the same effect. I think this would be a good idea. Wuffs types are not parameterized with lifetimes, so they may contain references only to items with static lifetime. This means that Wuffs cannot implement linked lists, hash tables, or other common data structures. To support those structu…
Re: Wuffs’ PNG image decoder
#83Earlier quoted context omitted.
Wuffs touts its lack of memory allocation as a safety feature [0]. Rust could add a `#![forbid(alloc)]` declaration and achieve the same effect. I think this would be a good idea. Wuffs types are not parameterized with lifetimes, so they may contain references only to items with static lifetime. This means that Wuffs cannot implement linked lists, hash tables, or other common data structures. To support those structu…
Isn't that stupidly limiting?
Re: Wuffs’ PNG image decoder
#84Aren’t all apps (anything not one-off scripts) performance and security conscious? Being performance and security conscious seems like the rule, not the exception.
Re: Wuffs’ PNG image decoder
#85I know there are information theory tradeoffs, but if you want to go really fast, use JPEG. Specifically, LibJpegTurbo. I have been playing around with this, and it is fast enough to encode a 1080p+ 8bpp framebuffer in under 5 milliseconds. This is fast enough for interactive applications. Most web browsers likely use something similar to this, so as long as you encode quickly on the server you can expect fast decode…
Re: Wuffs’ PNG image decoder
#86Re: Wuffs’ PNG image decoder
#87I know there are information theory tradeoffs, but if you want to go really fast, use JPEG. Specifically, LibJpegTurbo. I have been playing around with this, and it is fast enough to encode a 1080p+ 8bpp framebuffer in under 5 milliseconds. This is fast enough for interactive applications. Most web browsers likely use something similar to this, so as long as you encode quickly on the server you can expect fast decode…
Interesting! Do you have an example of how such a thing could be used in an interactive language?
All you need are 2 streams: 1 from client-to-server w/ all touch/keyboard events, and another from server-to-client with JPEG frames. One could easily build client devices using FPGAs or other integrated technologies with this sort of architecture.
The only caveats are latency & bandwidth requirements, but there are strategies for managing this, as well as problem domains where sufficient constraints exist on both counts (i.e. secure local networks).
Re: Wuffs’ PNG image decoder
#88Are there any compiletime benchmarks? I would be interested how much their approach scales in terms of code size, since they use likely SMT solvers to guarantee having no arithmetic overflows (which is more than Rust guarantees). Ideally as comparison with compile times of Rust programs.
Re: Wuffs’ PNG image decoder
#89Re: Wuffs’ PNG image decoder
#90Earlier quoted context omitted.
Wuffs touts its lack of memory allocation as a safety feature [0]. Rust could add a `#![forbid(alloc)]` declaration and achieve the same effect. I think this would be a good idea. Wuffs types are not parameterized with lifetimes, so they may contain references only to items with static lifetime. This means that Wuffs cannot implement linked lists, hash tables, or other common data structures. To support those structu…
> Rust could add a `#![forbid(alloc)]` declaration and achieve the same effect. Isn't that pretty much what `#![no_std]` is for? You can still use an allocator with no_std, but you have to explicitly import it. https://docs.rust-embedded.org/book/intro/no-std.html