Port back more efficient packing of string data from GHCJS to GHC javascript-backend
Summary
Javascript backend produces bundles with string data packed in inefficient form. Inefficient here means that actual bundle size becomes notably bigger than it could be.
For example, string data is encoded in a form where every symbol is coded as a char code in a list:
[72, 101, 108, 108, 111] // "Hello" w/o quotes.
"Hello" itself 5 symbols takes 24 symbols with spaces, commas and brackets.
There is an implementation of more efficient strings packing at GHCJS source code.
At first glance (very bird-eye-level analysis, any comments are highly welcome) it should pack "Hello" into something which is near the origin "Hello"
. So, 5 symbols should be packed into something near 7 symbols (quotes included).
References:
Expected behavior
By the end of this issue we expect to see better bundle size reduction after applying more efficient (in terms of bundle size) string packing and all tests are passed.
Environment
- GHC version used: commit
e1cf8dc2c941d36dc92139faa07ee6baf2599e38