emscripten-core / emscripten-core/emscripten

Evaluate hex encoding for embedding files?

Open
#7,211 18 comments 1 reaction 0 assignees View on GitHub
help wanted
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

It was just pointed out to me [in a Hacker News thread](https://news.ycombinator.com/item?id=18113129) that hex might be more efficient than base64 after gzip/brotli compression for `SINGLE_FILE`'s embedding.

His test showed that a hex-encoded wasm file was 65% the size of a base64-encoded wasm file after compression. My own test with a random 4.7 MB png I had sitting around showed that it didn't make a difference — with brotli they were all about the same (hex having the edge over base64 by 215 B and over the compressed original file by ~2.5 KB) and gzip was similar (in this case hex was ~600 KB bigger) — so it's unclear what the impact would be.

Just calling attention to this on the off chance that it would actually be an improvement, as I don't recall hex being considered when originally writing the `SINGLE_FILE` PR, and the previous discussion on encoding efficiencies (https://github.com/kripken/emscripten/pull/3326#issuecomment-91352434) has no mention of hex.

![balls.png](https://user-images.githubusercontent.com/415435/46327988-9fd2da80-c5d2-11e8-9e8a-b657a2ff94c6.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.