nv-buf-s2utf8ab
v1.0.3
Published
nv-buf-s2utf8ab ======================= - utf8-encoder for very small str (byte-length <=32) - same as (new TextEncoder()).encode
Downloads
10
Readme
nv-buf-s2utf8ab
- utf8-encoder for very small str (byte-length <=32)
- same as (new TextEncoder()).encode
install
- npm install nv-buf-s2utf8ab
usage
const x = require("nv-buf-s2utf8ab");
example
const TE = new TextEncoder();
var use_buf_from = (s)=>Buffer.from(s);
var use_text_encoder = (s)=>TE.encode(s);
var s="a\xff我𝑒".repeat(3)
var mach = x.creat_mach(64)
var f = (s)=>x.unsafe_encd(s,mach);
{
rounds: 1000000,
f: [Function: use_buf_from],
costed: 401.28613805770874
}
{
rounds: 1000000,
f: [Function: use_text_encoder],
costed: 660.0500421524048
}
{ rounds: 1000000, f: [Function: f], costed: 267.21566915512085 }
METHODS
APIS
LICENSE
- ISC