Преглед изворни кода

Correct performance metrics

Arjun Barrett пре 5 година
родитељ
комит
1181f2dcbf
7 измењених фајлова са 25 додато и 19 уклоњено
  1. 4 4
      README.md
  2. 7 7
      docs/README.md
  3. 2 2
      docs/interfaces/deflateoptions.md
  4. 4 4
      docs/interfaces/gzipoptions.md
  5. 2 2
      docs/interfaces/zliboptions.md
  6. 1 0
      package.json
  7. 5 0
      yarn.lock

+ 4 - 4
README.md

@@ -6,9 +6,9 @@ High performance (de)compression in an 8kB package
 
 |                           | `pako` | `tiny-inflate`       | `UZIP.js`             | `fflate`                       |
 |---------------------------|--------|----------------------|-----------------------|--------------------------------|
-| Decompression performance | 1x     | up to 10x slower     | **up to 40% faster**  | **up to 40% faster**           |
-| Compression performance   | 1x     | N/A                  | up to 5% faster       | **up to 50% faster**           |
-| Bundle size (minified)    | 44.5kB | **3 kB**             | 14.2kB                | 8kB **(3kB for only inflate)** |
+| Decompression performance | 1x     | Up to 40% slower     | **Up to 40% faster**  | **Up to 40% faster**           |
+| Compression performance   | 1x     | N/A                  | Up to 5% faster       | **Up to 50% faster**           |
+| Bundle size (minified)    | 44.5kB | **3kB**              | 14.2kB                | 8kB **(3kB for only inflate)** |
 | Compression support       | ✅     | ❌                    | ✅                    | ✅                             |
 | Thread/Worker safe        | ✅     | ✅                    | ❌                    | ✅                             |
 | GZIP/Zlib support         | ✅     | ❌                    | ❌                    | ✅                             |
@@ -100,7 +100,7 @@ See the [documentation](https://github.com/101arrowz/fflate/blob/master/docs/REA
 ## What makes `fflate` so fast?
 Many JavaScript compression/decompression libraries exist. However, the most popular one, [`pako`](https://npmjs.com/package/pako), is merely a clone of Zlib rewritten nearly line-for-line in JavaScript. Although it is by no means poorly made, `pako` doesn't recognize the many differences between JavaScript and C, and therefore is suboptimal for performance. Moreover, even when minified, the library is 45 kB; it may not seem like much, but for anyone concerned with optimizing bundle size (especially library authors), it's more weight than necessary.
 
-Note that there exist some small libraries like [`tiny-inflate`](https://npmjs.com/package/tiny-inflate) for solely decompression, and with a minified size of 3 kB, it can be appealing; however, its performance is extremely lackluster, up to 100x slower than `pako` for some larger files in my tests.
+Note that there exist some small libraries like [`tiny-inflate`](https://npmjs.com/package/tiny-inflate) for solely decompression, and with a minified size of 3 kB, it can be appealing; however, its performance is lackluster, typically 40% than `pako` in my tests.
 
 [`UZIP.js`](https://github.com/photopea/UZIP.js) is both faster (by up to 40%) and smaller (14 kB minified) than `pako`, and it contains a variety of innovations that make it excellent for both performance and compression ratio. However, the developer made a variety of tiny mistakes and inefficient design choices that make it imperfect. Moreover, it does not support GZIP or Zlib data directly; one must remove the headers manually to use `UZIP.js`.
 

+ 7 - 7
docs/README.md

@@ -24,7 +24,7 @@
 
 ▸ **decompress**(`data`: Uint8Array, `out?`: Uint8Array): Uint8Array
 
-*Defined in [index.ts:774](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L774)*
+*Defined in [index.ts:774](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L774)*
 
 Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format
 
@@ -43,7 +43,7 @@ ___
 
 ▸ **deflate**(`data`: Uint8Array, `opts`: [DeflateOptions](interfaces/deflateoptions.md)): Uint8Array
 
-*Defined in [index.ts:680](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L680)*
+*Defined in [index.ts:680](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L680)*
 
 Compresses data with DEFLATE without any wrapper
 
@@ -62,7 +62,7 @@ ___
 
 ▸ **gunzip**(`data`: Uint8Array, `out?`: Uint8Array): Uint8Array
 
-*Defined in [index.ts:720](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L720)*
+*Defined in [index.ts:720](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L720)*
 
 Expands GZIP data
 
@@ -81,7 +81,7 @@ ___
 
 ▸ **gzip**(`data`: Uint8Array, `opts`: [GZIPOptions](interfaces/gzipoptions.md)): Uint8Array
 
-*Defined in [index.ts:700](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L700)*
+*Defined in [index.ts:700](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L700)*
 
 Compresses data with GZIP
 
@@ -100,7 +100,7 @@ ___
 
 ▸ **inflate**(`data`: Uint8Array, `out?`: Uint8Array): Uint8Array
 
-*Defined in [index.ts:690](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L690)*
+*Defined in [index.ts:690](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L690)*
 
 Expands DEFLATE data with no wrapper
 
@@ -119,7 +119,7 @@ ___
 
 ▸ **unzlib**(`data`: Uint8Array, `out?`: Uint8Array): Uint8Array
 
-*Defined in [index.ts:758](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L758)*
+*Defined in [index.ts:758](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L758)*
 
 Expands Zlib data
 
@@ -138,7 +138,7 @@ ___
 
 ▸ **zlib**(`data`: Uint8Array, `opts`: [ZlibOptions](interfaces/zliboptions.md)): Uint8Array
 
-*Defined in [index.ts:737](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L737)*
+*Defined in [index.ts:737](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L737)*
 
 Compress data with Zlib
 

+ 2 - 2
docs/interfaces/deflateoptions.md

@@ -23,7 +23,7 @@ Options for compressing data into a DEFLATE format
 
 • `Optional` **level**: 0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9
 
-*Defined in [index.ts:632](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L632)*
+*Defined in [index.ts:632](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L632)*
 
 The level of compression to use, ranging from 0-9.
 
@@ -45,7 +45,7 @@ ___
 
 • `Optional` **mem**: 0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12
 
-*Defined in [index.ts:641](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L641)*
+*Defined in [index.ts:641](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L641)*
 
 The memory level to use, ranging from 0-12. Increasing this increases speed and compression ratio at the cost of memory.
 

+ 4 - 4
docs/interfaces/gzipoptions.md

@@ -23,7 +23,7 @@ Options for compressing data into a GZIP format
 
 • `Optional` **filename**: string
 
-*Defined in [index.ts:657](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L657)*
+*Defined in [index.ts:657](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L657)*
 
 The filename of the data. If the `gunzip` command is used to decompress the data, it will output a file
 with this name instead of the name of the compressed file.
@@ -36,7 +36,7 @@ ___
 
 *Inherited from [DeflateOptions](deflateoptions.md).[level](deflateoptions.md#level)*
 
-*Defined in [index.ts:632](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L632)*
+*Defined in [index.ts:632](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L632)*
 
 The level of compression to use, ranging from 0-9.
 
@@ -60,7 +60,7 @@ ___
 
 *Inherited from [DeflateOptions](deflateoptions.md).[mem](deflateoptions.md#mem)*
 
-*Defined in [index.ts:641](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L641)*
+*Defined in [index.ts:641](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L641)*
 
 The memory level to use, ranging from 0-12. Increasing this increases speed and compression ratio at the cost of memory.
 
@@ -75,7 +75,7 @@ ___
 
 • `Optional` **mtime**: Date \| string \| number
 
-*Defined in [index.ts:652](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L652)*
+*Defined in [index.ts:652](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L652)*
 
 When the file was last modified. Defaults to the current time.
 Set this to 0 to avoid specifying a modification date entirely.

+ 2 - 2
docs/interfaces/zliboptions.md

@@ -23,7 +23,7 @@ Options for compressing data into a Zlib format
 
 *Inherited from [DeflateOptions](deflateoptions.md).[level](deflateoptions.md#level)*
 
-*Defined in [index.ts:632](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L632)*
+*Defined in [index.ts:632](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L632)*
 
 The level of compression to use, ranging from 0-9.
 
@@ -47,7 +47,7 @@ ___
 
 *Inherited from [DeflateOptions](deflateoptions.md).[mem](deflateoptions.md#mem)*
 
-*Defined in [index.ts:641](https://github.com/101arrowz/fflate/blob/fe2a3b1/src/index.ts#L641)*
+*Defined in [index.ts:641](https://github.com/101arrowz/fflate/blob/5c43980/src/index.ts#L641)*
 
 The memory level to use, ranging from 0-12. Increasing this increases speed and compression ratio at the cost of memory.
 

+ 1 - 0
package.json

@@ -28,6 +28,7 @@
   },
   "devDependencies": {
     "pako": "^1.0.11",
+    "tiny-inflate": "^1.0.3",
     "typedoc": "^0.17.0-3",
     "typedoc-plugin-markdown": "^3.0.2",
     "typescript": "^4.0.2",

+ 5 - 0
yarn.lock

@@ -197,6 +197,11 @@ source-map@^0.6.1:
   resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
   integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
 
+tiny-inflate@^1.0.3:
+  version "1.0.3"
+  resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.3.tgz#122715494913a1805166aaf7c93467933eea26c4"
+  integrity sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==
+
 [email protected]:
   version "0.8.0-0"
   resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.8.0-0.tgz#80b7080837b2c9eba36c2fe06601ebe01973a0cd"