es-toolkit/docs/bundle-size.md

38 lines
1.8 KiB
Markdown
Raw Normal View History

2024-04-25 14:56:13 +03:00
---
description: The minimal bundle footprint offered by es-toolkit
---
# Bundle Footprint
2024-04-25 14:56:13 +03:00
![Graph showing the difference in bundle size between es-toolkit and lodash. There is a difference up to 97% in bundle size.](/assets/bundle-size.png)
With its modern implementation, es-toolkit significantly reduces its bundle size, cutting it down by up to 97% compared to other libraries like lodash.
2024-04-25 14:56:13 +03:00
This makes es-toolkit the most efficient in terms of bundle size, with some utility functions being as small as less than 100 bytes.
## Bundle Footprint Comparison
| | es-toolkit@0.0.1 | lodash-es@4.17.21 | Difference |
| ------------------------------------------ | ---------------- | ----------------- | ---------- |
| [sample](./reference/array/sample) | 88 bytes | 2000 bytes | -95.6% |
| [difference](./reference/array/difference) | 91 bytes | 3190 bytes | -97.2% |
| [sum](./reference/math/sum) | 152 bytes | 413 bytes | -63.2% |
| [debounce](./reference/function/debounce) | 144 bytes | 1400 bytes | -89.7% |
| [throttle](./reference/function/throttle) | 110 bytes | 1460 bytes | -92.5% |
| [pick](./reference/object/pick) | 657 bytes | 3860 bytes | -83.0% |
| [zip](./reference/array/zip) | 797 bytes | 1790 bytes | -55.5% |
2024-07-17 05:49:48 +03:00
## Bundle Size Test Method
Our bundle size is measured using [esbuild 0.23.0](https://esbuild.github.io), by analyzing the size of code like the following:
```tsx
2024-08-11 04:54:13 +03:00
import { chunk } from 'es-toolkit';
2024-10-01 08:52:25 +03:00
2024-07-17 05:49:48 +03:00
// or import { chunk } from 'lodash-es';
console.log(chunk);
```
See our [bundle size benchmark code](https://github.com/toss/es-toolkit/tree/main/benchmarks/bundle-size) for details.