refactor: performance optimizations

also renamed some internal types, and adding more code comments. (not thoroughly tested yet)
This commit is contained in:
Simon Chan 2024-05-04 23:47:52 +08:00
parent 65b8671b66
commit 8223d79886
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
49 changed files with 932 additions and 767 deletions

View file

@ -88,5 +88,7 @@ export function encodeUtf8(input: string): Uint8Array {
}
export function decodeUtf8(buffer: ArrayBufferView | ArrayBuffer): string {
// `TextDecoder` has internal states in stream mode,
// but we don't use stream mode here, so it's safe to reuse the instance
return Utf8Decoder.decode(buffer);
}