Skip to content

Conversation

@danleh
Copy link
Contributor

@danleh danleh commented Jan 29, 2025

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
Copy link
Contributor Author

danleh commented Jan 29, 2025

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

Copy link
Contributor

@eqrion eqrion left a comment

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
Copy link
Contributor Author

danleh commented Feb 10, 2025

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

Copy link
Contributor

@kmiller68 kmiller68 left a comment

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.

@danleh
Copy link
Contributor Author

danleh commented Feb 11, 2025

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

Copy link
Contributor

@kmiller68 kmiller68 left a comment

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
3 checks passed
@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