Skip to content

Update closure-compiler. NFC #24679

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jul 9, 2025

No description provided.

@sbc100 sbc100 requested a review from kripken July 9, 2025 23:52
@sbc100 sbc100 enabled auto-merge (squash) July 9, 2025 23:54
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code diffs look fine, but most of the size changes are small but worse. Maybe worth investigating one to see what changed?

@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 15, 2025

files.zip

@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 15, 2025

I attached the JS generated for the test_minimal_runtime_code_size_hello_embind test. The size differs by just one byte, but if I clang-format the files they don't differ at all.

Any idea how to find which is the differing byte here?

@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 15, 2025

Ah, I found an interesting hunk in the code generated by test_codesize_mem_O3_standalone_narg_flto:

@@ -139,7 +139,7 @@
   if (b.instantiateWasm)
     return new Promise(d => {b.instantiateWasm(c, (f, e) => {d(a(f, e))})});
   z ??= b.locateFile ? b.locateFile("a.out.wasm", n) : n + "a.out.wasm";
-  return a((await C(c)).instance)
+  return function(d) { return a(d.instance) }(await C(c))

@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 15, 2025

Looks like maybe some subtle async/await difference ?

@kripken
Copy link
Member

kripken commented Jul 15, 2025

-  return a((await C(c)).instance)
+  return function(d) { return a(d.instance) }(await C(c))

Hmm these are identical in every way I think, except that a stack trace would show that nameless thunk function..? Weird closure doesn't remove it, since it does inlining etc. so it is ok with changes to stack traces in principle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants