Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions test/codesize/test_no_closure_code_size.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"hello_world.js": 8052,
"hello_world.js.gz": 2929,
"hello_world.wasm": 1188,
"hello_world.wasm.gz": 733,
"web.js": 6149,
"web.js.gz": 2275,
"web.wasm": 1188,
"web.wasm.gz": 733,
"strict.js": 6178,
"strict.js.gz": 2341,
"strict.wasm": 1188,
"strict.wasm.gz": 733,
"files.js": 54641,
"files.js.gz": 15390,
"files.wasm": 371,
"files.wasm.gz": 264,
"total": 78955,
"total_gz": 25398
}
13 changes: 12 additions & 1 deletion test/test_codesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ def test_unoptimized_code_size(self):

self.check_output_sizes('hello_world.js', 'hello_world.wasm', 'no_asserts.js', 'no_asserts.wasm', 'strict.js', 'strict.wasm')

def test_no_closure_code_size(self):
# Track the size of -Os/-Oz builds without Closure Compiler (which is off
# by default).
# Run with `--rebaseline` when this test fails.
self.build('hello_world.c', cflags=['-Os', '--output-eol=linux'])
self.build('hello_world.c', cflags=['-Oz', '--output-eol=linux', '-sENVIRONMENT=web'], output_basename='web')
self.build('hello_world.c', cflags=['-Oz', '--output-eol=linux', '-sSTRICT'], output_basename='strict')
self.build('codesize/files.cpp', cflags=['-Oz', '--output-eol=linux', '-sNO_WASMFS'], output_basename='files')

self.check_output_sizes('hello_world.js', 'hello_world.wasm', 'web.js', 'web.wasm', 'strict.js', 'strict.wasm', 'files.js', 'files.wasm')

def run_codesize_test(self, filename, cflags, check_funcs=True, check_full_js=False, skip_gz=False):
# in -Os, -Oz, we remove imports wasm doesn't need
print(f'Running codesize test: {filename}:', cflags, check_funcs, check_full_js)
Expand Down Expand Up @@ -282,7 +293,7 @@ def run_codesize_test(self, filename, cflags, check_funcs=True, check_full_js=Fa
sent.sort()

# closure is not yet compatible with the WASM_ESM_INTEGRATION module glue.
closure_args = [] if esm else ['--closure=1']
closure_args = [] if (esm or '--closure=0' in cflags) else ['--closure=1']
self.run_process(build_cmd + ['--profiling-funcs'] + closure_args)

outputs = [outfile]
Expand Down
Loading