Skip to content

Commit be6e6e0

Browse files
committed
doc: add bundle sizes for encoding
1 parent ad213d0 commit be6e6e0

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,19 @@ import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-lit
107107
```
108108

109109
This reduces the bundle size 9x:\
110-
from 90 KiB gzipped for `@exodus/bytes/encoding.js` to 10 KiB gzipped for `@exodus/bytes/encoding-lite.js`.\
111-
(For comparison, `text-encoding` module is 190 KiB gzipped, and `iconv-lite` is 194 KiB gzipped):
110+
from 94 KiB gzipped for `@exodus/bytes/encoding.js` to 10 KiB gzipped for `@exodus/bytes/encoding-lite.js`.\
111+
(For comparison, `text-encoding` and `iconv-lite` are each over 195 KiB gzipped):
112+
113+
| import | size |
114+
| - | - |
115+
| `@exodus/bytes/encoding-browser.js` | <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square)</sub> |
116+
| `@exodus/bytes/encoding-lite.js` | <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square)</sub> |
117+
| `@exodus/bytes/encoding.js` | <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square)</sub> |
118+
| `text-encoding` | <sub>![](https://img.shields.io/bundlejs/size/text-encoding?style=flat-square)</sub> |
119+
| `iconv-lite` | <sub>![](https://img.shields.io/bundlejs/size/iconv-lite?style=flat-square)</sub> |
120+
| `whatwg-encoding` | <sub>![](https://img.shields.io/bundlejs/size/whatwg-encoding?style=flat-square)</sub> |
121+
122+
_Numbers differ a bit because compression differs._
112123

113124
It still supports `utf-8`, `utf-16le`, `utf-16be` and all single-byte encodings specified by the spec,
114125
the only difference is support for legacy multi-byte encodings.
@@ -667,7 +678,7 @@ Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`)
667678
> [!IMPORTANT]
668679
> Does not copy data, returns a view on the same underlying buffer
669680
670-
### @exodus/bytes/encoding.js
681+
### @exodus/bytes/encoding.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square)</sub>
671682

672683
Implements the [Encoding standard](https://encoding.spec.whatwg.org/):
673684
[TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder),
@@ -778,7 +789,7 @@ only expects lowercased encoding name:
778789
new TextDecoder(getBOMEncoding(input) ?? fallbackEncoding).decode(input)
779790
```
780791
781-
### @exodus/bytes/encoding-lite.js
792+
### @exodus/bytes/encoding-lite.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square)</sub>
782793
783794
The exact same exports as `@exodus/bytes/encoding.js` are also exported as
784795
`@exodus/bytes/encoding-lite.js`, with the difference that the lite version does not load
@@ -837,7 +848,7 @@ true
837848
'%'
838849
```
839850
840-
### @exodus/bytes/encoding-browser.js
851+
### @exodus/bytes/encoding-browser.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square)<sub>
841852
842853
Same as `@exodus/bytes/encoding.js`, but in browsers instead of polyfilling just uses whatever the
843854
browser provides, drastically reducing the bundle size (to less than 2 KiB gzipped).

0 commit comments

Comments
 (0)