-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Simplify _scriptName
/ scriptDirectory
handling. NFC
#24023
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
Conversation
Can you add some info to the PR description. |
Presumably this comes with some code size deltas? |
Marking as draft until I've written a PR description and rebasedlined the test expectations. |
944aaf2
to
89d55ff
Compare
76864c8
to
c457e42
Compare
Rebasedlined the test expectations and added a (short) PR description summarizing the changes. The changes to This is ready for review now. |
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.
Great!
Out of interest, do any/all of the new tests fail without this change?
- Avoid defining `_scriptName` outside the wrapper function in `EXPORT_ES6` mode and for Node.js CommonJS builds. - Simplify `scriptDirectory` resolution to `new URL('.', _scriptName).href` on the web.
The new tests also seem to pass on the main branch. IIRC, the Given this, this PR is (likely) a non-functional change now. I'll add the NFC keyword to the title. |
This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (86) test expectation files were updated by running the tests with `--rebaseline`: ``` browser/test_small_js_flags.js.size: 3996 => 3934 [-62 bytes / -1.55%] other/codesize/test_codesize_cxx_ctors1.gzsize: 8237 => 8208 [-29 bytes / -0.35%] other/codesize/test_codesize_cxx_ctors1.jssize: 19928 => 19920 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_ctors2.gzsize: 8226 => 8196 [-30 bytes / -0.36%] other/codesize/test_codesize_cxx_ctors2.jssize: 19906 => 19898 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_except.gzsize: 9227 => 9203 [-24 bytes / -0.26%] other/codesize/test_codesize_cxx_except.jssize: 23665 => 23657 [-8 bytes / -0.03%] other/codesize/test_codesize_cxx_except_wasm.gzsize: 8178 => 8156 [-22 bytes / -0.27%] other/codesize/test_codesize_cxx_except_wasm.jssize: 19821 => 19813 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize: 8178 => 8156 [-22 bytes / -0.27%] other/codesize/test_codesize_cxx_except_wasm_legacy.jssize: 19821 => 19813 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_lto.gzsize: 8244 => 8217 [-27 bytes / -0.33%] other/codesize/test_codesize_cxx_lto.jssize: 20003 => 19994 [-9 bytes / -0.04%] other/codesize/test_codesize_cxx_mangle.gzsize: 9270 => 9246 [-24 bytes / -0.26%] other/codesize/test_codesize_cxx_mangle.jssize: 23780 => 23772 [-8 bytes / -0.03%] other/codesize/test_codesize_cxx_noexcept.gzsize: 8237 => 8208 [-29 bytes / -0.35%] other/codesize/test_codesize_cxx_noexcept.jssize: 19928 => 19920 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_wasmfs.gzsize: 3413 => 3387 [-26 bytes / -0.76%] other/codesize/test_codesize_cxx_wasmfs.jssize: 7329 => 7320 [-9 bytes / -0.12%] other/codesize/test_codesize_files_js_fs.gzsize: 7527 => 7499 [-28 bytes / -0.37%] other/codesize/test_codesize_files_js_fs.jssize: 18510 => 18501 [-9 bytes / -0.05%] other/codesize/test_codesize_files_wasmfs.gzsize: 2668 => 2640 [-28 bytes / -1.05%] other/codesize/test_codesize_files_wasmfs.jssize: 5714 => 5703 [-11 bytes / -0.19%] other/codesize/test_codesize_hello_O0.gzsize: 7806 => 7785 [-21 bytes / -0.27%] other/codesize/test_codesize_hello_O0.jssize: 20758 => 20761 [+3 bytes / +0.01%] other/codesize/test_codesize_hello_O1.gzsize: 2534 => 2510 [-24 bytes / -0.95%] other/codesize/test_codesize_hello_O1.jssize: 6528 => 6536 [+8 bytes / +0.12%] other/codesize/test_codesize_hello_O2.gzsize: 2193 => 2170 [-23 bytes / -1.05%] other/codesize/test_codesize_hello_O2.jssize: 4508 => 4497 [-11 bytes / -0.24%] other/codesize/test_codesize_hello_O3.gzsize: 2149 => 2128 [-21 bytes / -0.98%] other/codesize/test_codesize_hello_O3.jssize: 4450 => 4439 [-11 bytes / -0.25%] other/codesize/test_codesize_hello_Os.gzsize: 2149 => 2128 [-21 bytes / -0.98%] other/codesize/test_codesize_hello_Os.jssize: 4450 => 4439 [-11 bytes / -0.25%] other/codesize/test_codesize_hello_Oz.gzsize: 2149 => 2128 [-21 bytes / -0.98%] other/codesize/test_codesize_hello_Oz.jssize: 4450 => 4439 [-11 bytes / -0.25%] other/codesize/test_codesize_hello_dylink.gzsize: 11753 => 11735 [-18 bytes / -0.15%] other/codesize/test_codesize_hello_dylink.jssize: 27782 => 27774 [-8 bytes / -0.03%] other/codesize/test_codesize_hello_export_nothing.gzsize: 1545 => 1520 [-25 bytes / -1.62%] other/codesize/test_codesize_hello_export_nothing.jssize: 3338 => 3325 [-13 bytes / -0.39%] other/codesize/test_codesize_hello_single_file.gzsize: 3673 => 3626 [-47 bytes / -1.28%] other/codesize/test_codesize_hello_single_file.jssize: 6732 => 6690 [-42 bytes / -0.62%] other/codesize/test_codesize_hello_wasmfs.gzsize: 2149 => 2128 [-21 bytes / -0.98%] other/codesize/test_codesize_hello_wasmfs.jssize: 4450 => 4439 [-11 bytes / -0.25%] other/codesize/test_codesize_libcxxabi_message_O3.gzsize: 1736 => 1713 [-23 bytes / -1.32%] other/codesize/test_codesize_libcxxabi_message_O3.jssize: 3713 => 3700 [-13 bytes / -0.35%] other/codesize/test_codesize_libcxxabi_message_O3_standalone.gzsize: 1769 => 1745 [-24 bytes / -1.36%] other/codesize/test_codesize_libcxxabi_message_O3_standalone.jssize: 3756 => 3743 [-13 bytes / -0.35%] other/codesize/test_codesize_mem_O3.gzsize: 2190 => 2171 [-19 bytes / -0.87%] other/codesize/test_codesize_mem_O3.jssize: 4579 => 4569 [-10 bytes / -0.22%] other/codesize/test_codesize_mem_O3_grow.gzsize: 2342 => 2323 [-19 bytes / -0.81%] other/codesize/test_codesize_mem_O3_grow.jssize: 4864 => 4854 [-10 bytes / -0.21%] other/codesize/test_codesize_mem_O3_grow_standalone.gzsize: 2035 => 2013 [-22 bytes / -1.08%] other/codesize/test_codesize_mem_O3_grow_standalone.jssize: 4277 => 4265 [-12 bytes / -0.28%] other/codesize/test_codesize_mem_O3_standalone.gzsize: 1999 => 1977 [-22 bytes / -1.10%] other/codesize/test_codesize_mem_O3_standalone.jssize: 4210 => 4197 [-13 bytes / -0.31%] other/codesize/test_codesize_mem_O3_standalone_lib.gzsize: 1761 => 1739 [-22 bytes / -1.25%] other/codesize/test_codesize_mem_O3_standalone_lib.jssize: 3769 => 3756 [-13 bytes / -0.34%] other/codesize/test_codesize_mem_O3_standalone_narg.gzsize: 1769 => 1745 [-24 bytes / -1.36%] other/codesize/test_codesize_mem_O3_standalone_narg.jssize: 3756 => 3743 [-13 bytes / -0.35%] other/codesize/test_codesize_mem_O3_standalone_narg_flto.gzsize: 1769 => 1745 [-24 bytes / -1.36%] other/codesize/test_codesize_mem_O3_standalone_narg_flto.jssize: 3756 => 3743 [-13 bytes / -0.35%] other/codesize/test_codesize_minimal_64.gzsize: 1317 => 1290 [-27 bytes / -2.05%] other/codesize/test_codesize_minimal_64.jssize: 2775 => 2763 [-12 bytes / -0.43%] other/codesize/test_codesize_minimal_O0.gzsize: 6119 => 6099 [-20 bytes / -0.33%] other/codesize/test_codesize_minimal_O0.jssize: 16141 => 16143 [+2 bytes / +0.01%] other/codesize/test_codesize_minimal_O1.gzsize: 1381 => 1352 [-29 bytes / -2.10%] other/codesize/test_codesize_minimal_O1.jssize: 3240 => 3246 [+6 bytes / +0.19%] other/codesize/test_codesize_minimal_O2.gzsize: 1247 => 1221 [-26 bytes / -2.09%] other/codesize/test_codesize_minimal_O2.jssize: 2522 => 2510 [-12 bytes / -0.48%] other/codesize/test_codesize_minimal_O3.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_O3.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_Os.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_Os.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_Oz-ctors.gzsize: 1197 => 1171 [-26 bytes / -2.17%] other/codesize/test_codesize_minimal_Oz-ctors.jssize: 2451 => 2439 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_Oz.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_Oz.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_esm.gzsize: 1404 => 1298 [-106 bytes / -7.55%] other/codesize/test_codesize_minimal_esm.jssize: 2928 => 2697 [-231 bytes / -7.89%] other/codesize/test_codesize_minimal_pthreads.gzsize: 4041 => 3983 [-58 bytes / -1.44%] other/codesize/test_codesize_minimal_pthreads.jssize: 8380 => 8257 [-123 bytes / -1.47%] other/codesize/test_codesize_minimal_wasmfs.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_wasmfs.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/test_unoptimized_code_size.js.size: 51838 => 51593 [-245 bytes / -0.47%] other/test_unoptimized_code_size_no_asserts.js.size: 27206 => 26961 [-245 bytes / -0.90%] other/test_unoptimized_code_size_strict.js.size: 49906 => 49661 [-245 bytes / -0.49%] Average change: -0.84% (-7.89% - +0.19%) ```
c457e42
to
65b2a41
Compare
_scriptName
/ scriptDirectory
handling_scriptName
/ scriptDirectory
handling. NFC
BTW, do you know if |
It seems unlikely that was ever tested. I think its unlike that |
Can you add this info the to the PR? i.e. explain why the new tests are useful, even though they pass before and after this PR? |
I love this change BTW. I've tried to do something like this myself several times in the past but always given up. Thanks! |
Sure, I've just added another bullet point with this info to the PR description.
No problem! :) |
_scriptName
outside the wrapper function inEXPORT_ES6
mode and for Node.js CommonJS builds.scriptDirectory
resolution tonew URL('.', _scriptName).href
on the web.scriptDirectory
is an absolute path across different build configurations.