-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Don't generate minification variables if not needed #59400
Don't generate minification variables if not needed #59400
Conversation
dadf2cf
to
e40132b
Compare
I wonder if we can make a test for this. Can we use |
I could write a test which would simply load the searchIndex file and if an error occurs, it means the generation failed. However, this would require a new test-suite since we need to build using |
I was thinking something even simpler, doing a substring search using a |
Such a test would completely fail to trigger when a minification issue would appear. :-/ |
Is this added complexity worth it to save a few bytes in the none minified |
This is a simple change which generates less things. For me, it's totally worth it, although we can't really test it (or we'll need to create a whole new test suite, which I'd prefer to avoid). |
☔ The latest upstream changes (presumably #59950) made this pull request unmergeable. Please resolve the merge conflicts. |
e40132b
to
380105a
Compare
☔ The latest upstream changes (presumably #60296) made this pull request unmergeable. Please resolve the merge conflicts. |
380105a
to
582c836
Compare
@QuietMisdreavus Could we get a review/decision here either way? I'm personally also somewhat inclined to say that we shouldn't do this as the 10-20 bytes we're saving aren't really worth the complexity introduced here in my opinion. |
Easy to say when you're not the one debugging the minified JS. :p |
Oh also, it fixes a bug currently present in the code, it doesn't add a new feature. Therefore it seems pretty worth it (but my opinion is completely biased in here since I use this feature quite heavily). |
Ah, I was not aware that this fixes a bug -- I presumed that the variables don't hurt if they're unused, but I guess that's not true. |
By default, people don't have this bug since it needs a nightly-only option to be enabled. So indeed, it doesn't hurt to have unused variables if they're really not used. However, in here in some cases, the code references to them. |
@bors: r+ |
📌 Commit 582c836 has been approved by |
continue; | ||
} | ||
if line.starts_with(&format!(r#"{}["{}"]"#, key, krate)) { | ||
if line.starts_with(MINIFIED_VARIABLES) { | ||
is_minified = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dead code. The above:
if !line.starts_with(key) || line.starts_with(&format!(r#"{}["{}"]"#, key, krate)) {
continue;
}
means that line.starts_with(MINIFIED_VARIABLES)
can never be true. This means that the minification variables are missing if the last call to rustdoc used --disable-minification
but previous ones didn't.
@bors r- Again I don't think this added complexity is worth it. Especially when it doesn't even work and has no tests. |
☔ The latest upstream changes (presumably #62041) made this pull request unmergeable. Please resolve the merge conflicts. |
Hi @GuillaumeGomez this is a ping from Triage. Please post an update on this PR at your earliest convenience. |
@ollie27 is against it so I guess I'll just close it... |
Follow up of #59158 and #59157.
r? @QuietMisdreavus
cc @jdm