fastestsmallesttextencoderdecoder
Advanced tools
Comparing version 1.0.20 to 1.0.21
@@ -1,5 +0,6 @@ | ||
'use strict';(function(n){function x(){}function z(b){var a=b.charCodeAt(0)|0;if(55296<=a&&56319>=a)if(b=b.charCodeAt(1)|0,56320<=b&&57343>=b){if(a=(a<<10)+b-56613888|0,65535<a)return r(240|a>>>18,128|a>>>12&63,128|a>>>6&63,128|a&63)}else a=65533;return 2047>=a?r(192|a>>>6,128|a&63):r(224|a>>>12,128|a>>>6&63,128|a&63)}function y(){}var r=String.fromCharCode,t={}.toString,A=t.call(n.SharedArrayBuffer),B=t(),q=n.Uint8Array,u=q||Array,v=q?ArrayBuffer:u,C=v.isView||function(b){return b&&"length"in b}, | ||
D=t.call(v.prototype);v=y.prototype;var E=n.TextEncoder,F=/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,l=new (q?Uint16Array:u)(8192);x.prototype.decode=function(b){if(!C(b)){var a=t.call(b);if(a!==D&&a!==A&&a!==B)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");b=q?new u(b):b||[]}a="";for(var c=0,p=b.length|0,g,d=0,w=31,h=0,m=0,f,e=0,k=0;c<p;){for(;c<p&&8192>e;c=c+1|0,e=e+1|0)switch(g=b[c]&255,g>>> | ||
4){case 15:w>>>=1,f=b[c=c+1|0]&255,d=f&63,m=2===f>>>6&&248>g?5:20,h=6;case 14:w>>>=1,f=b[c=c+1|0]&255,d<<=6,d|=f&63,m=2===f>>>6?m+4|0:24,h=h+6|0;case 13:case 12:f=b[c=c+1|0]&255,d<<=6,d|=f&63,m=2===f>>>6?m+7|0:31,h=h+6|0,d|=(g&w)<<h,c<p&&d>>>m&&1114112>d?(g=d,65535<d&&(d=d-65536|0,k=(d>>>10)+55296|0,g=(d&1023)+56320|0,8191>e?(l[e]=k,e=e+1|0,k=-1):(f=k,k=g,g=f))):(c=c-(h/6|0)|0,g=65533),w=31,d=m=h=0;case 7:case 6:case 5:case 4:case 3:case 2:case 1:case 0:l[e]=g;continue;case 8:case 9:case 10:case 11:l[e]= | ||
65533}a+=r.apply(null,2048===e?l:q?l.subarray(0,e):l.slice(0,e));l[0]=k;e=-1!==k?1:0;k=-1}return a};n.TextDecoder||(n.TextDecoder=x);v.encode=function(b){var a;b=(void 0===b?"":""+b).replace(F,z);var c=b.length|0;var p=new u(c);for(a=0;a<c;a=a+1|0)p[a]=b.charCodeAt(a);return p};E||(n.TextEncoder=y)})(""+void 0==typeof global?""+void 0==typeof self?this:self:global);//AnonyCo | ||
'use strict';(function(q){function x(){}function y(){}var z=String.fromCharCode,v={}.toString,A=v.call(q.SharedArrayBuffer),B=v(),r=q.Uint8Array,t=r||Array,w=r?ArrayBuffer:t,C=w.isView||function(g){return g&&"length"in g},D=v.call(w.prototype);w=y.prototype;var E=q.TextEncoder,a=new (r?Uint16Array:t)(32);x.prototype.decode=function(g){if(!C(g)){var l=v.call(g);if(l!==D&&l!==A&&l!==B)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); | ||
g=r?new t(g):g||[]}for(var e=l="",b=0,c=g.length|0,u=c-32|0,f,d,h=0,p=0,m,k=0,n=-1;b<c;){for(f=b<=u?32:c-b|0;k<f;b=b+1|0,k=k+1|0){d=g[b]&255;switch(d>>4){case 15:m=g[b=b+1|0]&255;if(2!==m>>6||247<d){b=b-1|0;break}h=(d&7)<<6|m&63;p=5;d=256;case 14:m=g[b=b+1|0]&255,h<<=6,h|=(d&15)<<6|m&63,p=2===m>>6?p+4|0:24,d=d+256&768;case 13:case 12:m=g[b=b+1|0]&255,h<<=6,h|=(d&31)<<6|m&63,p=p+7|0,b<c&&2===m>>6&&h>>p&&1114112>h?(d=h,h=h-65536|0,0<=h&&(n=(h>>10)+55296|0,d=(h&1023)+56320|0,31>k?(a[k]=n,k=k+1|0,n=-1): | ||
(m=n,n=d,d=m))):(d>>=8,b=b-d-1|0,d=65533),h=p=0,f=b<=u?32:c-b|0;default:a[k]=d;continue;case 11:case 10:case 9:case 8:}a[k]=65533}e+=z(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18],a[19],a[20],a[21],a[22],a[23],a[24],a[25],a[26],a[27],a[28],a[29],a[30],a[31]);32>k&&(e=e.slice(0,k-32|0));if(b<c){if(a[0]=n,k=~n>>>31,n=-1,e.length<l.length)continue}else-1!==n&&(e+=z(n));l+=e;e=""}return l};q.TextDecoder||(q.TextDecoder=x);w.encode=function(g){g= | ||
void 0===g?"":""+g;var l=g.length|0,e=new t((l<<1)+9|0),b,c=0,u=!r;for(b=0;b<l;b=b+1|0,c=c+1|0){var f=g.charCodeAt(b)|0;if(127>=f)e[c]=f;else{if(2047>=f)e[c]=192|f>>6;else{if(55296<=f&&56319>=f){var d=g.charCodeAt(b=b+1|0)|0;if(56320<=d&&57343>=d){if(f=(f<<10)+d-56613888|0,65535<f){e[c]=240|f>>18;e[c=c+1|0]=128|f>>12&63;e[c=c+1|0]=128|f>>6&63;e[c=c+1|0]=128|f&63;continue}}else f=65533}else!u&&b<<1<c&&b<<1<(c-9|0)&&(u=!0,d=new t(3*l),d.set(e),e=d);e[c]=224|f>>12;e[c=c+1|0]=128|f>>6&63}e[c=c+1|0]=128| | ||
f&63}}return r?e.subarray(0,c):e.slice(0,c)};E||(q.TextEncoder=y)})(""+void 0==typeof global?""+void 0==typeof self?this:self:global);//AnonyCo | ||
//# sourceMappingURL=https://cdn.jsdelivr.net/gh/AnonyCo/FastestSmallestTextEncoderDecoder/EncoderDecoderTogether.min.js.map |
@@ -1,6 +0,7 @@ | ||
'use strict';(function(k){var t=String.fromCharCode,u={}.toString,v=k.SharedArrayBuffer,H=v?u.call(v):"",q=k.Uint8Array,I=q?u.call(ArrayBuffer.prototype):"",g=k.Buffer,J=/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,r=new Uint16Array(8192);try{!g&&k.require&&(g=k.require("Buffer"));var A=g.prototype;var K=g?u.call(A):""}catch(a){}var B=!!q&&!g,L=!g||!!q&&q.prototype.isPrototypeOf(A),y=k.TextEncoder,z=k.TextDecoder;if(B||g){var w=function(a){a.TextDecoder=z||C;a.TextEncoder=y||D;a!== | ||
k&&(a.decode=z?E(new z,"decode"):F,a.encode=y?E(new y,"encode"):G);return a},E=function(a,b,c){c=a[b];return function(){return c.apply(a,arguments)}},G=function(a){a=void 0===a?"":(""+a).replace(J,M);for(var b=a.length|0,c=B?new q(b):g.allocUnsafe?g.allocUnsafe(b):new g(b),l=0;l<b;l=l+1|0)c[l]=a.charCodeAt(l)|0;return c},D=function(){},M=function(a){var b=a.charCodeAt(0)|0;if(55296<=b&&56319>=b)if(a=a.charCodeAt(1)|0,56320<=a&&57343>=a){if(b=(b<<10)+a-56613888|0,65535<b)return t(240|b>>>18,128|b>>> | ||
12&63,128|b>>>6&63,128|b&63)}else b=65533;return 2047>=b?t(192|b>>>6,128|b&63):t(224|b>>>12,128|b>>>6&63,128|b&63)},F=function(a){var b=a&&a.buffer||a,c=u.call(b);if(c!==I&&c!==K&&c!==H&&"[object ArrayBuffer]"!==c&&void 0!==a)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");a=L?new q(b):b||[];b="";c=0;for(var l=a.length|0,h,d=0,x=31,m=0,p=0,f,e=0,n=0;c<l;){for(;c<l&&8192>e;c=c+1|0,e=e+1|0)switch(h=a[c]&255,h>>>4){case 15:x>>>= | ||
1,f=a[c=c+1|0]&255,d=f&63,p=2===f>>>6&&248>h?5:20,m=6;case 14:x>>>=1,f=a[c=c+1|0]&255,d<<=6,d|=f&63,p=2===f>>>6?p+4|0:24,m=m+6|0;case 13:case 12:f=a[c=c+1|0]&255,d<<=6,d|=f&63,p=2===f>>>6?p+7|0:31,m=m+6|0,d|=(h&x)<<m,c<l&&d>>>p&&1114112>d?(h=d,65535<d&&(d=d-65536|0,n=(d>>>10)+55296|0,h=(d&1023)+56320|0,8191>e?(r[e]=n,e=e+1|0,n=-1):(f=n,n=h,h=f))):(c=c-(m/6|0)|0,h=65533),x=31,d=p=m=0;case 7:case 6:case 5:case 4:case 3:case 2:case 1:case 0:r[e]=h;continue;case 8:case 9:case 10:case 11:r[e]=65533}b+= | ||
t.apply(null,8192===e?r:r.subarray(0,e));r[0]=n;e=-1!==n?1:0;n=-1}return b},C=function(){};C.prototype.decode=F;v=D.prototype;v.encode=G;"object"===typeof exports&&"undefined"!==typeof module?w(module.exports):typeof define==typeof w&&"function"===typeof define&&define.amd?define(function(){return w({})}):w(k)}})("undefined"==typeof global?"undefined"==typeof self?this||{}:self:global);//AnonyCo | ||
'use strict';(function(n){var t=String.fromCharCode,u={}.toString,v=n.SharedArrayBuffer,I=v?u.call(v):"",q=n.Uint8Array,J=q?u.call(ArrayBuffer.prototype):"",l=n.Buffer,K=/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,a=new Uint16Array(32);try{!l&&n.require&&(l=n.require("Buffer"));var A=l.prototype;var L=l?u.call(A):""}catch(b){}var B=!!q&&!l,M=!l||!!q&&q.prototype.isPrototypeOf(A),x=n.TextEncoder,y=n.TextDecoder;if(B||l){var w=function(b){b.TextDecoder=y||C;b.TextEncoder=x||D;b!== | ||
n&&(b.decode=y?E(new y,"decode"):F,b.encode=x?E(new x,"encode"):G);return b},E=function(b,c,e){e=b[c];return function(){return e.apply(b,arguments)}},G=function(b){b=void 0===b?"":(""+b).replace(K,N);for(var c=b.length|0,e=B?new q(c):l.allocUnsafe?l.allocUnsafe(c):new l(c),d=0;d<c;d=d+1|0)e[d]=b.charCodeAt(d)|0;return e},D=function(){},N=function(b){var c=b.charCodeAt(0)|0;if(55296<=c&&56319>=c)if(b=b.charCodeAt(1)|0,56320<=b&&57343>=b){if(c=(c<<10)+b-56613888|0,65535<c)return t(240|c>>18,128|c>> | ||
12&63,128|c>>6&63,128|c&63)}else c=65533;return 2047>=c?t(192|c>>6,128|c&63):t(224|c>>12,128|c>>6&63,128|c&63)},F=function(b){var c=b&&b.buffer||b,e=u.call(c);if(e!==J&&e!==L&&e!==I&&"[object ArrayBuffer]"!==e&&void 0!==b)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");b=M?new q(c):c||[];e=c="";for(var d=0,r=b.length|0,H=r-32|0,z,f,g=0,p=0,k,h=0,m=-1;d<r;){for(z=d<=H?32:r-d|0;h<z;d=d+1|0,h=h+1|0){f=b[d]&255;switch(f>> | ||
4){case 15:k=b[d=d+1|0]&255;if(2!==k>>6||247<f){d=d-1|0;break}g=(f&7)<<6|k&63;p=5;f=256;case 14:k=b[d=d+1|0]&255,g<<=6,g|=(f&15)<<6|k&63,p=2===k>>6?p+4|0:24,f=f+256&768;case 13:case 12:k=b[d=d+1|0]&255,g<<=6,g|=(f&31)<<6|k&63,p=p+7|0,d<r&&2===k>>6&&g>>p&&1114112>g?(f=g,g=g-65536|0,0<=g&&(m=(g>>10)+55296|0,f=(g&1023)+56320|0,31>h?(a[h]=m,h=h+1|0,m=-1):(k=m,m=f,f=k))):(f>>=8,d=d-f-1|0,f=65533),g=p=0,z=d<=H?32:r-d|0;default:a[h]=f;continue;case 11:case 10:case 9:case 8:}a[h]=65533}e+=t(a[0],a[1],a[2], | ||
a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18],a[19],a[20],a[21],a[22],a[23],a[24],a[25],a[26],a[27],a[28],a[29],a[30],a[31]);32>h&&(e=e.slice(0,h-32|0));if(d<r){if(a[0]=m,h=~m>>>31,m=-1,e.length<c.length)continue}else-1!==m&&(e+=t(m));c+=e;e=""}return c},C=function(){};C.prototype.decode=F;v=D.prototype;v.encode=G;"object"===typeof exports&&"undefined"!==typeof module?w(module.exports):typeof define==typeof w&&"function"===typeof define&&define.amd?define(function(){return w({})}): | ||
w(n)}})("undefined"==typeof global?"undefined"==typeof self?this||{}:self:global);//AnonyCo | ||
//# sourceMappingURL=https://cdn.jsdelivr.net/gh/AnonyCo/FastestSmallestTextEncoderDecoder/NodeJS/EncoderAndDecoderNodeJS.min.js.map |
{ | ||
"name": "fastestsmallesttextencoderdecoder", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "The fastest smallest Javascript polyfill for the encode of TextEncoder and decode of TextDecoder for UTF-8 only. Made by AnonyCo with ❤️ from 🐕s.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,4 +8,4 @@ | ||
[![npm bundle size (version)](https://img.shields.io/bundlephobia/min/fastestsmallesttextencoderdecoder/latest.svg?color=maroon&label=NPM%20bundle%20size)](https://npmjs.org/package/fastestsmallesttextencoderdecoder "View this project on npm")<!--[![Issues](http://img.shields.io/github/issues/anonyco/FastestSmallestTextEncoderDecoder.svg)]( https://github.com/anonyco/FastestSmallestTextEncoderDecoder/issues )--> | ||
[![npm downloads](https://img.shields.io/npm/dt/fastestsmallesttextencoderdecoder.svg)](https://npmjs.org/package/fastestsmallesttextencoderdecoder "View this project on npm") | ||
[![CC0 license](https://camo.githubusercontent.com/4df6de8c11e31c357bf955b12ab8c55f55c48823/68747470733a2f2f6c6963656e7365627574746f6e732e6e65742f702f7a65726f2f312e302f38387833312e706e67)](https://creativecommons.org/share-your-work/public-domain/cc0/ "This project's liscence") | ||
[![npm downloads](https://img.shields.io/npm/dt/fastestsmallesttextencoderdecoder.svg)](https://npmjs.org/package/fastestsmallesttextencoderdecoder "View this project on npm") | ||
@@ -34,4 +34,8 @@ This Javascript library provides the most performant tiny polyfill for [`window.TextEncoder`](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder), [`TextEncoder.prototype.encodeInto`](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encodeInto), and [`window.TextDecoder`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder) for use in [the browser](https://developer.mozilla.org/en-US/docs/Web/API/Window), in [NodeJS](https://nodejs.org/en/docs/), in [RequireJS](https://requirejs.org/docs/whyamd.html), in web [Worker](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope)s, in [SharedWorker](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorkerGlobalScope)s, and in [ServiceWorker](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope)s. | ||
See the [MDN here](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encodeInto) for documentation. For the TextEncoder.prototype.encodeInto polyfill, please use `https://dl.dropboxusercontent.com/s/i2e2rho1ohtbhfg/EncoderDecoderTogether.min.js?dl=0` for the full package, `https://dl.dropboxusercontent.com/s/nlcgzbr0ayd5pjs/FastestTextEncoderPolyfill.min.js?dl=0` for only TextEncoder and TextEncoder.prototype.encodeInto, and `npm i fastestsmallesttextencoderdecoder-encodeinto` for NodeJS, es6 modules, RequireJS, AngularJS, or whatever it is that floats your boat. The [encodeInto](https://raw.githubusercontent.com/anonyco/FastestSmallestTextEncoderDecoder/master/encodeInto/) folder of this repository contains the auto-generated encodeInto build of the main project. | ||
See the [MDN here](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encodeInto) for documentation. For the TextEncoder.prototype.encodeInto polyfill, please use `https://dl.dropboxusercontent.com/s/i2e2rho1ohtbhfg/EncoderDecoderTogether.min.js?dl=0` for the full package, `https://dl.dropboxusercontent.com/s/nlcgzbr0ayd5pjs/FastestTextEncoderPolyfill.min.js?dl=0` for only TextEncoder and TextEncoder.prototype.encodeInto, and `npm i fastestsmallesttextencoderdecoder-encodeinto` for NodeJS, es6 modules, RequireJS, AngularJS, or whatever it is that floats your boat. The [encodeInto](https://github.com/anonyco/FastestSmallestTextEncoderDecoder/tree/master/encodeInto) folder of this repository contains the auto-generated encodeInto build of the main project. The npm project is [fastestsmallesttextencoderdecoder-encodeinto](https://www.npmjs.com/package/fastestsmallesttextencoderdecoder-encodeinto): | ||
``` | ||
npm install fastestsmallesttextencoderdecoder-encodeinto | ||
``` | ||
## RequireJS and NodeJS | ||
@@ -70,13 +74,13 @@ | ||
The tests below were performed on an ascii file. To ensure consistancy, all test results are the mean of the IQR of many many trials. | ||
The tests below were performed on an ascii file. To ensure consistancy, all test results are the mean of the IQR of many many trials. The checkmark "✔" means that the encoder/decoder implementation gave the correct output, whereas a bold "**✗**" indicates an incorrect output. This extra check is signifigant because relying on a faulty encoder/decoder can lead to inconsistant behaviors in code that defaults to using the native implementation where available. | ||
| Library | Decode 32 bytes | Decode 32768 | Decode 16777216 | Encode 32 bytes | Encode 32768 | Encode 16777216 | | ||
| ------- | --------------- | ------------ | --------------- | --------------- | ------------ | --------------- | | ||
| [fast-text-encoding](https://github.com/samthor/fast-text-encoding) | 44247 Kb/sec | 73765 Kb/sec | 99360 Kb/sec | 11135 Kb/sec | 20393 Kb/sec | 27898 Kb/sec | | ||
| [text-encoding](https://github.com/inexorabletash/text-encoding)) | 5483 Kb/sec | 6718 Kb/sec | 7982 Kb/sec | 6001 Kb/sec | 5198 Kb/sec | 7950 Kb/sec | | ||
| [TextEncoderTextDecoder.js](https://gist.github.com/Yaffle/5458286) | 5989 Kb/sec | 5240 Kb/sec | 6376 Kb/sec | 8608 Kb/sec | 7815 Kb/sec | 12733 Kb/sec | | ||
| [TextEncoderLite](https://github.com/solderjs/TextEncoderLite) | 19731 Kb/sec | 24746 Kb/sec | 13843 Kb/sec | 10357 Kb/sec | 8690 Kb/sec | 13093 Kb/sec | | ||
| [text-encoding-shim](https://gitlab.com/PseudoPsycho/text-encoding-shim) | 15415 Kb/sec | 17477 Kb/sec | 26779 Kb/sec | 6692 Kb/sec | 9431 Kb/sec | 15477 Kb/sec | | ||
| FastestSmallestTextEncoderDecoder | 48268 Kb/sec | 106573 Kb/sec | 193986 Kb/sec | 14203 Kb/sec | 21734 Kb/sec | 31994 Kb/sec | | ||
| <i>Native</i> | 20248 Kb/sec | 895592 Kb/sec | 886559 Kb/sec | 17925 Kb/sec | 26714 Kb/sec | 36302 Kb/sec | | ||
| <i>Native</i> | 10201 KB/sec ✔ | 806451 KB/sec ✔ | 907381 KB/sec ✔ | 53415 KB/sec ✔ | 4661211 KB/sec ✔ | 1150916 KB/sec ✔ | | ||
| FastestSmallestTextEncoderDecoder | 18038 KB/sec ✔ | 154839 KB/sec ✔ | 168984 KB/sec ✔ | 21667 KB/sec ✔ | 404279 KB/sec ✔ | 681429 KB/sec ✔ | | ||
| [fast-text-encoding](https://github.com/samthor/fast-text-encoding) | 17518 KB/sec ✔ | 71806 KB/sec ✔ | 99017 KB/sec ✔ | 22713 KB/sec ✔ | 240880 KB/sec ✔ | 445137 KB/sec ✔ | | ||
| [text-encoding-shim](https://gitlab.com/PseudoPsycho/text-encoding-shim) | 10205 KB/sec ✔ | 17503 KB/sec ✔ | 27971 KB/sec ✔ | 14044 KB/sec ✔ | 50007 KB/sec ✔ | 88687 KB/sec ✔ | | ||
| [TextEncoderLite](https://github.com/solderjs/TextEncoderLite) | 12433 KB/sec ✔ | 23456 KB/sec ✔ | 13929 KB/sec ✔ | 24013 KB/sec ✔ | 57034 KB/sec ✔ | 62119 KB/sec ✔ | | ||
| [TextEncoderTextDecoder.js](https://gist.github.com/Yaffle/5458286) | 4469 KB/sec ✔ | 5956 KB/sec ✔ | 5626 KB/sec ✔ | 13576 KB/sec ✔ | 37667 KB/sec ✔ | 57916 KB/sec ✔ | | ||
| [text-encoding](https://github.com/inexorabletash/text-encoding) | 3084 KB/sec ✔ | 6762 KB/sec ✔ | 7925 KB/sec ✔ | 8621 KB/sec ✔ | 26699 KB/sec ✔ | 35755 KB/sec ✔ | | ||
@@ -87,21 +91,21 @@ Needless to say, FastestSmallestTextEncoderDecoder outperformed every other polyfill out there. Infact, it is so fast that it outperformed the native implementation on a set of 32 ascii bytes. The tests below were performed on a mixed ascii-utf8 file. | ||
| ------- | --------------- | ------------ | --------------- | --------------- | ------------ | --------------- | | ||
| [fast-text-encoding](https://github.com/samthor/fast-text-encoding) | 39218 Kb/sec | 65368 Kb/sec | 93653 Kb/sec | 12144 Kb/sec | 20309 Kb/sec | 29522 Kb/sec | | ||
| [text-encoding](https://github.com/inexorabletash/text-encoding)) | 4931 Kb/sec | 6405 Kb/sec | 8323 Kb/sec | 6906 Kb/sec | 4352 Kb/sec | 8077 Kb/sec | | ||
| [TextEncoderTextDecoder.js](https://gist.github.com/Yaffle/5458286) | 7675 Kb/sec | 5423 Kb/sec | 7264 Kb/sec | 8946 Kb/sec | 6816 Kb/sec | 12716 Kb/sec | | ||
| [TextEncoderLite](https://github.com/solderjs/TextEncoderLite) | 9034 Kb/sec | 10380 Kb/sec | 10372 Kb/sec | 10771 Kb/sec | 7452 Kb/sec | 12727 Kb/sec | | ||
| [text-encoding-shim](https://gitlab.com/PseudoPsycho/text-encoding-shim) | 13735 Kb/sec | 14886 Kb/sec | 24207 Kb/sec | 7634 Kb/sec | 9097 Kb/sec | 15349 Kb/sec | | ||
| FastestSmallestTextEncoderDecoder | 42538 Kb/sec | 65701 Kb/sec | 118350 Kb/sec | 14834 Kb/sec | 21717 Kb/sec | 31811 Kb/sec | | ||
| <i>Native</i> | 23929 Kb/sec | 364062 Kb/sec | 512951 Kb/sec | 19296 Kb/sec | 26902 Kb/sec | 37260 Kb/sec | | ||
| <i>Native</i> | 24140 KB/sec ✔ | 365043 KB/sec ✔ | 512133 KB/sec ✔ | 54183 KB/sec ✔ | 293455 KB/sec ✔ | 535203 KB/sec ✔ | | ||
| FastestSmallestTextEncoderDecoder | 13932 KB/sec ✔ | 113823 KB/sec ✔ | 141706 KB/sec ✔ | 20755 KB/sec ✔ | 212100 KB/sec ✔ | 443344 KB/sec ✔ | | ||
| [fast-text-encoding](https://github.com/samthor/fast-text-encoding) | 10738 KB/sec ✔ | 62851 KB/sec ✔ | 94031 KB/sec ✔ | 15105 KB/sec ✔ | 104843 KB/sec ✔ | 320778 KB/sec ✔ | | ||
| [TextEncoderLite](https://github.com/solderjs/TextEncoderLite) | 6594 KB/sec ✔ | 9893 KB/sec ✔ | 10470 KB/sec ✔ | 17660 KB/sec **✗** | 53905 KB/sec **✗** | 57862 KB/sec **✗** | | ||
| [text-encoding-shim](https://gitlab.com/PseudoPsycho/text-encoding-shim) | 10778 KB/sec ✔ | 15063 KB/sec ✔ | 24373 KB/sec ✔ | 27296 KB/sec ✔ | 31496 KB/sec ✔ | 42497 KB/sec ✔ | | ||
| [TextEncoderTextDecoder.js](https://gist.github.com/Yaffle/5458286) | 5558 KB/sec ✔ | 5121 KB/sec ✔ | 6580 KB/sec ✔ | 14583 KB/sec ✔ | 32261 KB/sec ✔ | 60183 KB/sec ✔ | | ||
| [text-encoding](https://github.com/inexorabletash/text-encoding) | 3531 KB/sec ✔ | 6669 KB/sec ✔ | 7983 KB/sec ✔ | 7233 KB/sec ✔ | 20343 KB/sec ✔ | 29136 KB/sec ✔ | | ||
Suprisingly, FastestSmallestTextEncoderDecoded once again beats the native implementation by a wide margin on a set of 32 characters. In the next test, let's examine a more real world example—the [1876 The Russian Synodal Bible.txt](https://github.com/anonyco/FastestSmallestTextEncoderDecoder/blob/master/test/1876%20The%20Russian%20Synodal%20Bible.txt). It's a whoping 4.4MB rat's-nest of complex Russian UTF-8, sure to give any encoder/decoder a bad day. Let's see how they perform at their worst. | ||
FastestSmallestTextEncoderDecoder excells at encoding lots of complex unicode and runs at 83% the speed of the native implementation. In the next test, let's examine a more real world example—the [1876 The Russian Synodal Bible.txt](https://github.com/anonyco/FastestSmallestTextEncoderDecoder/blob/master/test/1876%20The%20Russian%20Synodal%20Bible.txt). It's a whoping 4.4MB rat's-nest of complex Russian UTF-8, sure to give any encoder/decoder a bad day. Let's see how they perform at their worst. | ||
| Library | Decode Russian Bible | Encode Russian Bible | | ||
| ------- | -------------------- | -------------------- | | ||
| [fast-text-encoding](https://github.com/samthor/fast-text-encoding) | 93174 Kb/sec | 34207 Kb/sec | | ||
| [text-encoding](https://github.com/inexorabletash/text-encoding)) | 8120 Kb/sec | 8026 Kb/sec | | ||
| [TextEncoderTextDecoder.js](https://gist.github.com/Yaffle/5458286) | 6102 Kb/sec | 12512 Kb/sec | | ||
| [TextEncoderLite](https://github.com/solderjs/TextEncoderLite) | 15564 Kb/sec | 12650 Kb/sec | | ||
| [text-encoding-shim](https://gitlab.com/PseudoPsycho/text-encoding-shim) | 28146 Kb/sec | 17437 Kb/sec | | ||
| FastestSmallestTextEncoderDecoder | 106154 Kb/sec | 35684 Kb/sec | | ||
| <i>Native</i> | 870569 Kb/sec | 43547 Kb/sec | | ||
| <i>Native</i> | 626273 KB/sec ✔ | 951538 KB/sec ✔ | | ||
| FastestSmallestTextEncoderDecoder | 228360 KB/sec ✔ | 428625 KB/sec ✔ | | ||
| [fast-text-encoding](https://github.com/samthor/fast-text-encoding) | 94666 KB/sec ✔ | 289109 KB/sec ✔ | | ||
| [text-encoding-shim](https://gitlab.com/PseudoPsycho/text-encoding-shim) | 29335 KB/sec ✔ | 60508 KB/sec ✔ | | ||
| [TextEncoderLite](https://github.com/solderjs/TextEncoderLite) | 14079 KB/sec ✔ | 61648 KB/sec ✔ | | ||
| [TextEncoderTextDecoder.js](https://gist.github.com/Yaffle/5458286) | 5989 KB/sec ✔ | 54741 KB/sec ✔ | | ||
| [text-encoding](https://github.com/inexorabletash/text-encoding) | 7919 KB/sec ✔ | 28043 KB/sec ✔ | | ||
@@ -217,3 +221,3 @@ | ||
I try my best to be a realist, and what's more realistic than death? I am going to die someday and it may be tomorrow in a car crash. You never know. As I have no coder freinds to look out for my projects, I'm looking for anyone who wants to be a collaborator on this project in the event of the unforseen. Reach out to me at wowzeryest@gmail.com. If issues/pulls start piling up over the course of months, assume the worst. As I am trying my best to do my part to help the community, I encourage every developer to share their projects with other people to ensure continuity. | ||
Feel free to reach out to me at wowzeryest@gmail.com. I am fairly attentive to my github account, but in the unlikely event that issues/pulls start piling up, I of course welcome others to step in and contribute. I am widely open to input and collaboration from anyone on all of my projects. | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42926
34
219