-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emscripten and the Producers Section #93
Comments
I can see the logic behind these reasons and I wish they had been brought up in earlier discussions, where I was specifically hoping to hear from tooling people whether the producer section would actually show up in release builds. With Emscripten setting the precedent of stripping the section for these reasons, I can imagine the convention not being widely adopted which makes me question whether it's worth it to add browser telemetry. At the very least, it seems like this warrants an update to ProducersSection.md to re-set expectations, or maybe just removing ProducersSection.md entirely if there are no other consumers. |
WebAssembly/tool-conventions#93 has a summary of emscripten's current thinking on this. For Binaryen, we don't want to do anything to the producers section by default, but do want it to be possible to optionally remove it. To achieve that, this PR * creates a --strip-producers pass that removes that section. * creates a --strip-debug pass that removes debug info, same as the old --strip, which is still around but deprecated. A followup in emscripten will use this pass by default.
My thoughts on this have essentially flipped from my original: I think the Producers Section is a good thing to have in general, but probably doesn't make sense for Emscripen to emit. The general principle I'm following here is one of incentives: what pressures exist on the various parties? From the other side of the table though, what benefits can people get from the data provided by the producers section? So it makes sense for toolchains like the Rust compiler to annotate their wasms with producers sections, because being able to definitively say "Rust is used in 10% of the wasm modules on the web today" would be a huge victory. Whereas for establisted toolchains (Emscripten being practically unique in this regard), tracking proliferation of use is less important. I believe the background assumption we're all implicitly making is that Emscripten is used for 99+% of the wasm that's built today, which makes quantifying that less appealing than saving the ~100 bytes. All that is to say, I don't think precedent matters as much as incentives here, because people will ultimately do what benefits themselves the most anyway. For Emscripten I believe this means to strip it, but for other toolchains I think the visibility incentive is sufficient for this to see use. (Alternatively, my wild counter-proposal would be to not have any producers section at all, and run analysis based on "this wasm looks like it was built with tool ___" heuristics after-the-fact, which is imprecise and compute-heavy but requires no opt-in. We could always just do both, or use heuristic analysis only on the non-annotated modules, depending on how things actually shake out down the line) |
I think this is really the way to go, actually. The main benefit is that it would not be a statistically biased sample: with the producers section, size-conscious websites (most of them?) will strip it out, and the remainder may well be different in what tools they use. The analysis approach would actually be sampling the real population of production wasms. Analysis is not easy, obviously. But it would just need to run on a tiny random sample of the wasms on the Web (so it's not compute-heavy, necessarily; also validating it on that set would be enough). If we all collaborated on this it might not be that hard. I'd volunteer to help if that's relevant. |
How about.. making the producers section really small (1 LEB per producer) so there is no incentive to strip it for size? :) |
It's not too hard to eyeball and spot an asm2wasm, wasm backend, rust, go etc. But this won't provide nearly as much info as the producer section will. |
This still has the section overhead... |
Reducing the incentive doesn't remove it. If I could choose between $100 disappearing out of my bank account vs. $1, I'd still be mad that the bank is losing my money for no reason. I don't mind when my balance goes down when I buy something, however, so the question is how can we get people to feel the cost is worthwhile? Actually wait, second wild proposal: don't put the bytes inside |
So for ProducersSection.md, I get the impression maybe we shouldn't remove it entirely, but file a PR to:
Yes? |
Should we discuss about that during the WebAssembly GC meeting tomorrow? |
Sorry, I missed this comment in time to add it to the agenda, but yes, that would've made sense. |
As suggested by @xtuc in [tool-conventions/#93](WebAssembly/tool-conventions#93).
As suggested by @xtuc in [tool-conventions/#93](WebAssembly/tool-conventions#93).
My impression is that the meeting didn't clarify what we should do here. I think it's unfortunate, but I agree with @lukewagner's #93 (comment). |
After a lot of consideration, I don't think we want to change Emscripten to emit the producers section by default in release builds. Posting this issue to note that and explain why.
emcc
started one day to emit information like what compiler and tools our users use - most people would probably be surprised by that, and some might be concerned about it, for privacy or security reasons.// minified by $MINIFERNAME
comment in your minified code. I can't even find a flag to do this optionally in any minifiers.emcc
to emit the smallest binary, we should do that, unless there's a very strong reason, and I'm not sure users would agree that the metrics we are talking about here are reason enough, based on discussions I had with some of them. The metrics are mostly of interest to browser vendors and tool creators, but it's the users that ship the extra bytes. Many users will probably flip a flag to remove those bytes, if they heard about that flag's existence, which suggests it should be on by default.These are reasons for specifically not emitting the producers section in
emcc
by default. We could add an option for users that do want to do so, and of course other tools may have different factors to consider (in particular, Emscripten is used by ordinary developers, while tools like LLVM, wabt, or binaryen are used by toolchain developers, so the considerations might be different).The text was updated successfully, but these errors were encountered: