Repository navigation
Use destructuring for timeOrigin in emscripten_get_now. NFC - #28286
Merged
Merged
Conversation
Apply followup feedback from emscripten-core#28272 in `src/lib/libcore.js`. Use `const {timeOrigin} = performance;` instead of `var` so Closure Compiler lowers it to `let` rather than a hoisted `var` and destructuring assignment, saving bytes both with and without Closure. See: emscripten-core#28272
timeOrigin in emscripten_get_nowtimeOrigin in emscripten_get_now. NFC
There was a problem hiding this comment.
Code Review
This pull request refactors the retrieval of performance.timeOrigin in src/lib/libcore.js to use object destructuring. The reviewer suggests providing a default value of 0 during destructuring to prevent potential NaN values if performance.timeOrigin is undefined in certain environments.
Collaborator
Did you run update sizes? |
Collaborator
Author
Yes, a few bytes, but we don't have any codesize tests that cover pthreads + audio worklets, which is where this code lives. |
RReverser
approved these changes
Nov 17, 2026
sbc100
added a commit
to sbc100/emscripten
that referenced
this pull request
Nov 17, 2026
Followup to emscripten-core#28286 Use object and parameter destructuring for multi-property reads and unused event parameters across `src/lib/` and `src/pthread_esm_startup.mjs`, using `const` for declarations so Closure Compiler lowers them cleanly without extra bindings. Also update `src/jsifier.mjs` arrow-function detection so top-level JS library arrow functions with destructured parameters (containing `}`) are recognized and emitted properly. Update affected `test/codesize/` expectations. See: emscripten-core#28272
sbc100
added a commit
to sbc100/emscripten
that referenced
this pull request
Nov 17, 2026
Followup to emscripten-core#28286 Use object and parameter destructuring for multi-property reads and unused event parameters across `src/lib/` and `src/pthread_esm_startup.mjs`, using `const` for declarations so Closure Compiler lowers them cleanly without extra bindings. Also update `src/jsifier.mjs` arrow-function detection so top-level JS library arrow functions with destructured parameters (containing `}`) are recognized and emitted properly. Update affected `test/codesize/` expectations. See: emscripten-core#28272
sbc100
added a commit
to sbc100/emscripten
that referenced
this pull request
Nov 18, 2026
Followup to emscripten-core#28286 Use object and parameter destructuring for multi-property reads and unused event parameters across `src/lib/` and `src/pthread_esm_startup.mjs`, using `const` for declarations so Closure Compiler lowers them cleanly without extra bindings. Update affected `test/codesize/` expectations. See: emscripten-core#28272
sbc100
added a commit
to sbc100/emscripten
that referenced
this pull request
Nov 18, 2026
Followup to emscripten-core#28286 Use object and parameter destructuring for multi-property reads and unused event parameters across `src/lib/` and `src/pthread_esm_startup.mjs`, using `const` for declarations so Closure Compiler lowers them cleanly without extra bindings. Update affected `test/codesize/` expectations. See: emscripten-core#28272
sbc100
added a commit
to sbc100/emscripten
that referenced
this pull request
Nov 23, 2026
Followup to emscripten-core#28286 Use object and parameter destructuring for multi-property reads and unused event parameters across `src/lib/` and `src/pthread_esm_startup.mjs`, using `const` for declarations so Closure Compiler lowers them cleanly without extra bindings. Update affected `test/codesize/` expectations. See: emscripten-core#28272
sbc100
added a commit
that referenced
this pull request
Nov 23, 2026
Followup to #28286 Depends on #28288 Use object and parameter destructuring for multi-property reads and unused event parameters across `src/lib/` and `src/pthread_esm_startup.mjs`, using `const` for declarations so Closure Compiler lowers them cleanly without extra bindings. Update affected `test/codesize/` expectations. See: #28272
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apply followup feedback from #28272 in
src/lib/libcore.js. Useconst {timeOrigin} = performance;instead ofvarso Closure Compiler lowers it toletrather than a hoistedvarand destructuring assignment, saving bytes both with and without Closure.See: #28272