Skip to content
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

Support compression in sync push/pull #502

Open
3 tasks
yume-chan opened this issue Feb 28, 2023 · 4 comments
Open
3 tasks

Support compression in sync push/pull #502

yume-chan opened this issue Feb 28, 2023 · 4 comments
Labels
effort: high type:enhancement New feature or request
Milestone

Comments

@yume-chan
Copy link
Owner

yume-chan commented Feb 28, 2023

Android 11 added support for Brotli compression in sync push/pull, Android 12 further added lz4 and zstd support. Using compression can result in up to 2x transfer speed.

Algorithms:

From https://android-review.googlesource.com/c/platform/system/core/+/1276917, pull speed in MB/s:

           none    brotli    lz4
USB 3.0     120       110    190
USB 2.0      38        75     63

No pure-JS implementations of all three algorithms were found on NPM. Need to create them ourselves.

Android 12 also added a dry-run flag in push/pull for testing. Shouldn't be useful in real situations: https://android-review.googlesource.com/c/platform/system/core/+/1276918

@yume-chan yume-chan added the type:enhancement New feature or request label Feb 28, 2023
@yume-chan yume-chan added this to the Backlog milestone Mar 2, 2023
@gogogoghost
Copy link

Have to using pure-JS to implement it? How about WebAssembly? It can also be cross-platform and has good performance.

@yume-chan
Copy link
Owner Author

WebAssembly is also an option. Do you know any WebAssembly build for those compression algorithms?

@kuzalekon
Copy link

kuzalekon commented Jan 31, 2024

Hi @yume-chan

For example, we can use these packages: brotli-wasm, lz4-wasm and zstd-wasm.

@yume-chan
Copy link
Owner Author

I had already checked brotli-wasm and lz4-wasm.

brotli-wasm is the most promising one, but it does work (out-of-the-box) with Vite (httptoolkit/brotli-wasm#8), so it can't be used in a library that may be consumed by any bundler.

lz4-wasm doesn't expose streaming compression API so can't be used.

zstd-wasm has 0 documentation so I don't know what it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: high type:enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants