Skip to content

Add zlib-wasm workload - #43

Merged
kmiller68 merged 4 commits into
WebKit:mainfrom
danleh:zlib-wasm
Feb 12, 2025
Merged

kmiller68 merged 4 commits into
WebKit:mainfrom
danleh:zlib-wasm

Conversation

@danleh

@danleh danleh commented Jan 29, 2025

Copy link
Copy Markdown
Contributor

As a replacement for the asm.js zlib workload in Octane that we removed.
Based on public domain zpipe.c example from https://www.zlib.net/zlib_how.html.
Compresses a ~60KB Wasm binary, and decompresses it again.
Built with Emscripten, using zlib Emscripten port.
A single iteration takes around 50ms, the total line item around 2s.

As a replacement for the asm.js zlib workload in Octane that we removed.
Based on public domain zpipe.c example from https://www.zlib.net/zlib_how.html.
Compresses about 60KB of Wasm binary, and decompresses again.
Built with Emscripten, using zlib Emscripten port.
A single iteration takes around 50ms, the total line item around 2s.
@danleh

danleh commented Jan 29, 2025

Copy link
Copy Markdown
Contributor Author

In #37 (comment) we discussed adding a compression/LZ77-style replacement workload, now that we removed the asm.js Octane zlib workload. Since there is a zlib port for Emscripten, this is actually quite straightforward, so what do you think of this workload? @kmiller68 @eqrion @jandem

@eqrion eqrion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This LGTM. Clever to re-use the wasm binary as the file to compress.

@danleh

danleh commented Feb 10, 2025

Copy link
Copy Markdown
Contributor Author

@kmiller68 Rebased and ready to be merged from my side.

@kmiller68 kmiller68 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you're missing some fcloses, but maybe there's some magic that does it for you? Also, do you know how much time we spend in the fopen emscripten glue? It'd be nice to make sure we don't repeat the async-fs test where all the time is in Math.random.

Comment thread wasm/zlib/src/main.c Resolved
@danleh

danleh commented Feb 11, 2025 •

Copy link
Copy Markdown
Contributor Author

Also, do you know how much time we spend in the fopen emscripten glue? It'd be nice to make sure we don't repeat the async-fs test where all the time is in Math.random.

According to a profile I just took (d8 on x64), we spend ~95.5% of the CPU cycles in Wasm code, ~3% compiling and in the GC, and just <1.5% in JS code, so the Emscripten glue code looks fine to me.

image

Comment thread wasm/zlib/benchmark.js Resolved
Comment thread wasm/zlib/benchmark.js Resolved

@kmiller68 kmiller68 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM too.

@kmiller68
kmiller68 merged commit 4352dab into WebKit:main Feb 12, 2025
@danleh
danleh deleted the zlib-wasm branch February 12, 2025 14:18
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.

3 participants