Skip to content

Commit bf2d736

Browse files
committed
doc: add bundle sizes for encoding
1 parent c9ba7a0 commit bf2d736

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

README.md

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

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

112123
It still supports `utf-8`, `utf-16le`, `utf-16be` and all single-byte encodings specified by the spec,
113124
the only difference is support for legacy multi-byte encodings.
@@ -668,6 +679,8 @@ Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`)
668679
669680
### @exodus/bytes/encoding.js
670681

682+
![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square)
683+
671684
Implements the [Encoding standard](https://encoding.spec.whatwg.org/):
672685
[TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder),
673686
[TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder),
@@ -779,6 +792,8 @@ new TextDecoder(getBOMEncoding(input) ?? fallbackEncoding).decode(input)
779792
780793
### @exodus/bytes/encoding-lite.js
781794
795+
![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square)
796+
782797
The exact same exports as `@exodus/bytes/encoding.js` are also exported as
783798
`@exodus/bytes/encoding-lite.js`, with the difference that the lite version does not load
784799
multi-byte `TextDecoder` encodings by default to reduce bundle size 10x.
@@ -838,6 +853,8 @@ true
838853
839854
### @exodus/bytes/encoding-browser.js
840855
856+
![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square)
857+
841858
Same as `@exodus/bytes/encoding.js`, but in browsers instead of polyfilling just uses whatever the
842859
browser provides, drastically reducing the bundle size (to less than 2 KiB gzipped).
843860

0 commit comments

Comments
 (0)