mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 16:42:21 -05:00
21 lines
41 KiB
JavaScript
21 lines
41 KiB
JavaScript
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||
|
|
||
|
import { StringDecoder } from "internal:deno_node/polyfills/string_decoder.ts";
|
||
|
|
||
|
const stringDecoder = new StringDecoder();
|
||
|
|
||
|
// deno-fmt-ignore
|
||
|
const smallUint8 = new Uint8Array([226, 132, 149, 32, 226, 138, 134, 32, 226, 132, 149, 226, 130, 128, 32, 226, 138, 130, 32, 226, 132, 164, 32, 226, 138, 130, 32, 226, 132, 154, 32, 226, 138, 130, 32, 226, 132, 157, 32, 226, 138, 130, 32, 226, 132, 130, 44, 32, 226, 138, 165, 32, 60, 32, 97, 32, 226, 137, 160, 32, 98, 32, 226, 137, 161, 32, 99, 32, 226, 137, 164, 32, 100, 32, 226, 137, 170, 32, 226, 138, 164, 32, 226, 135, 146, 32, 40, 65, 32, 226, 135, 148, 32, 66, 41, 44])
|
||
|
// deno-fmt-ignore
|
||
|
const bigUint8 = new Uint8Array([60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 104, 116, 109, 108, 62, 10, 60, 104, 116, 109, 108, 32, 108, 97, 110, 103, 61, 34, 101, 110, 34, 62, 10, 10, 60, 104, 101, 97, 100, 62, 10, 32, 32, 32, 32, 60, 109, 101, 116, 97, 32, 99, 104, 97, 114, 115, 101, 116, 61, 34, 85, 84, 70, 45, 56, 34, 62, 10, 32, 32, 32, 32, 60, 116, 105, 116, 108, 101, 62, 104, 116, 116, 112, 98, 105, 110, 46, 111, 114, 103, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 32, 32, 32, 60, 108, 105, 110, 107, 32, 104, 114, 101, 102, 61, 34, 104, 116, 116, 112, 115, 58, 47, 47, 102, 111, 110, 116, 115, 46, 103, 111, 111, 103, 108, 101, 97, 112, 105, 115, 46, 99, 111, 109, 47, 99, 115, 115, 63, 102, 97, 109, 105, 108, 121, 61, 79, 112, 101, 110, 43, 83, 97, 110, 115, 58, 52, 48, 48, 44, 55, 48, 48, 124, 83, 111, 117, 114, 99, 101, 43, 67, 111, 100, 101, 43, 80, 114, 111, 58, 51, 48, 48, 44, 54, 48, 48, 124, 84, 105, 116, 105, 108, 108, 105, 117, 109, 43, 87, 101, 98, 58, 52, 48, 48, 44, 54, 48, 48, 44, 55, 48, 48, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, 114, 101, 108, 61, 34, 115, 116, 121, 108, 101, 115, 104, 101, 101, 116, 34, 62, 10, 32, 32, 32, 32, 60, 108, 105, 110, 107, 32, 114, 101, 108, 61, 34, 115, 116, 121, 108, 101, 115, 104, 101, 101, 116, 34, 32, 116, 121, 112, 101, 61, 34, 116, 101, 120, 116, 47, 99, 115, 115, 34, 32, 104, 114, 101, 102, 61, 34, 47, 102, 108, 97, 115, 103, 103, 101, 114, 95, 115, 116, 97, 116, 105, 99, 47, 115, 119, 97, 103, 103, 101, 114, 45, 117, 105, 46, 99, 115, 115, 34, 62, 10, 32, 32, 32, 32, 60, 108, 105, 110, 107, 32, 114, 101, 108, 61, 34, 105, 99, 111, 110, 34, 32, 116, 121, 112, 101, 61, 34, 105, 109, 97, 103, 101, 47, 112, 110, 103, 34, 32, 104, 114, 101, 102, 61, 34, 47, 115, 116, 97, 116, 105, 99, 47, 102, 97, 118, 105, 99, 111, 110, 46, 105, 99, 111, 34, 32, 115, 105, 122, 101, 115, 61, 34, 54, 52, 120, 54, 52, 32, 51, 50, 120, 51, 50, 32, 49, 54, 120, 49, 54, 34, 32, 47, 62, 10, 32, 32, 32, 32, 60, 115, 116, 121, 108, 101, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 104, 116, 109, 108, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 98, 111, 120, 45, 115, 105, 122, 105, 110, 103, 58, 32, 98, 111, 114, 100, 101, 114, 45, 98, 111, 120, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 111, 118, 101, 114, 102, 108, 111, 119, 58, 32, 45, 109, 111, 122, 45, 115, 99, 114, 111, 108, 108, 98, 97, 114, 115, 45, 118, 101, 114, 116, 105, 99, 97, 108, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 111, 118, 101, 114, 102, 108, 111, 119, 45, 121, 58, 32, 115, 99, 114, 111, 108, 108, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 42, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 42, 58, 98, 101, 102, 111, 114, 101, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 42, 58, 97, 102, 116, 101, 114, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 98, 111, 120, 45, 115, 105, 122, 105, 110, 103, 58, 32, 105, 110, 104, 101, 114, 105, 116, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 98, 111, 100, 121, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 109, 97, 114, 103, 105, 110, 58, 32, 48, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 32, 35, 102, 97, 102, 97, 102, 97, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 60, 47, 115, 116, 121, 108, 101, 62, 10, 60, 47, 104, 101, 97, 100, 62, 10, 10, 60, 98, 111, 100, 121, 62, 10, 32, 32, 32, 32, 60, 97, 32, 104, 114, 101, 102, 61, 34, 104, 116, 116, 112, 115, 58, 47, 47, 103, 105, 116, 104, 117, 98, 46, 99, 111, 109, 47, 114, 101, 113, 117, 101, 115, 116, 115, 47, 104, 116, 116, 112, 98, 105, 110, 34, 32, 99, 108, 97, 115, 115, 61, 34, 103, 105, 116, 104, 117, 98, 45, 99, 111, 114, 110, 101, 114, 34, 32, 97, 114, 105, 97, 45, 108, 97, 98, 101, 108, 61, 34, 86, 105, 101, 119, 32, 115, 111, 117, 114, 99, 101, 32, 111, 110, 32, 71, 105, 116, 104, 117, 98, 34, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 115, 118, 103, 32, 119, 105, 100, 116, 104, 61, 34, 56, 48, 34, 32, 10
|
||
|
|
||
|
Deno.bench("smallUint8", () => {
|
||
|
stringDecoder.write(smallUint8);
|
||
|
stringDecoder.end();
|
||
|
});
|
||
|
|
||
|
Deno.bench("bigUint8", () => {
|
||
|
stringDecoder.write(bigUint8);
|
||
|
stringDecoder.end();
|
||
|
});
|