241 points · by Tomte · 5y ago · 68 comments
And the WASM sandbox should be airtight, which means it's much safer to run C code in WASM than directly!
I'm mainly a Python developer, so an accompanying revelation was that projects like wasmer-python then give me the same opportunity in my default environment - call out to best-in-breed C/Rust/etc libraries without the risk and misery of needing to compile and package them as Python extensions. Instead, wait for the JavaScript WASM community to figure out how to use them and take advantage of their work from my Python projects as well.
Java/JVM is a strong compilation target but it is mainly a language and an ecosystem, wasm is building an impressive ecosystem but it is mainly a compilation target designed to be easily embeddable anywhere.
Essentially the only things they have in common is the "run everywhere" slogan.
To actually answer your question with my opinions:
- wasm has a stronger sandbox and will (likely) never have any runtime reflection capability
- wasm is primarily meant to be easily embedded/interpreted
- wasm is extremely small
- it offers no new functionality that isn't already present in javascript (this will eventually become false)
- wasm lives within the sandbox of the browser
- it is standardized together with javascript inside the web platform, not as a separate entity
It turns out we want something that is much smaller and much lighter than applets, and is developed as an open collaborative standard from the start.
We also want it built into browsers (so users don't have to install anything else).
Finally, it turns out we don't need it to be able to render directly its own area of the screen - a very non-obvious improvement over applets.
Anything is safer than to run C code directly ;)
The Squoosh CLI has an auto-optimizer that will make an image as small as possible while staying under a given Butteraugli threshold, but you still have to decide on the format yourself.
(jake, is that you?)
You seem to be right. Gonna fix the CLI (the CLI is my doing)
Do you express the resulting file size or the amount saved? “30%” could mean you “30% of the original file size” or “you shaved off 30% of the original file size”. You could denote the difference with a sign, like “-30%” but that still confuses people. We ran both options by a lot of our colleagues.
“x% of the original file size” is the least ambiguous, but who has the space to put that entire phrase in their app :-/
If your main goal is to avoid misunderstanding (which it isn't always) then in my opinion it's best not to have anything to do with percentages. Instead, just give the ratio. It might not be elegant, and perhaps some people won't understand it at all, but "0.7x compression" cannot, I think, be misunderstood. (Or can it? I wait to be corrected!)
Squoosh is available in npm, which should make this pretty easy: https://www.npmjs.com/package/@squoosh/cli
I hope google team also add support for GIF compression, currently I'm using https://gifcompressor.com
Also, it would be convenient if there's a native Windows client which gives the option to select and compress images using context menu itself.
As for animations, video formats with a very low fps are usually way better suited and smaller than GIFs.
What kind of explanation would you like to see? We link to the repo and the Privacy explainer at the bottom of the page. Why is it important to you to know that it’s made by Googlers?
If you mean compress all images in an S3 bucket? Not directly. But we do have a Squoosh CLI!