1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00
denoland-deno/tests/unit_node
Divy Srivastava 1ba88a7892
perf(ext/node): improve Buffer from string performance (#24567)
Fixes https://github.com/denoland/deno/issues/24323

- Use a Buffer pool for `fromString`
- Implement fast call base64 writes
- Direct from string `create` method for each encoding op

```
$ deno bench -A bench.mjs # 1.45.1+fee4d3a
cpu: Apple M1 Pro
runtime: deno 1.45.1+fee4d3a (aarch64-apple-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      550 ns/iter     (490 ns … 1'265 ns)    572 ns    606 ns  1'265 ns
Buffer#write base64     285 ns/iter       (259 ns … 371 ns)    307 ns    347 ns    360 ns

$ ~/gh/deno/target/release/deno bench -A bench.mjs # this PR
cpu: Apple M1 Pro
runtime: deno dev (aarch64-apple-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      151 ns/iter       (145 ns … 770 ns)    148 ns    184 ns    648 ns
Buffer#write base64   62.58 ns/iter     (60.79 ns … 157 ns)  61.65 ns  75.79 ns    141 ns

$ node bench.mjs # v22.4.0
cpu: Apple M1 Pro
runtime: node v22.4.0 (arm64-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      163 ns/iter     (96.92 ns … 375 ns)  99.45 ns    127 ns    220 ns
Buffer#write base64   75.48 ns/iter     (74.97 ns … 134 ns)  75.17 ns  81.83 ns  96.84 ns
```
2024-07-30 18:09:55 +05:30
..
_fs chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
crypto chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
internal chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
testdata fix(ext/node): rewrite digest handling (#24392) 2024-07-05 10:10:22 +02:00
_test_utils.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
assert_test.ts fix(node/assert): throws not checking error instance (#24466) 2024-07-08 21:28:39 +02:00
assertion_error_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
async_hooks_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
buffer_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
child_process_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
console_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
dgram_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
domain_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
events_test.ts fix(ext/node): implement EventEmitterAsyncResource (#22994) 2024-03-20 11:20:18 +05:30
fs_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
http2_test.ts fix(ext/node): prevent panic in http2.connect with uppercase header names (#24780) 2024-07-29 13:33:55 +02:00
http_test.ts test(ext/node): reduce http_test flakiness (#24742) 2024-07-27 22:47:47 +09:00
module_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
net_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
os_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
path_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
perf_hooks_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
process_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
punycode_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
querystring_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
readline_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
repl_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
stream_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
string_decoder_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
timers_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
tls_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
tty_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
util_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
v8_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
vm_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
worker_threads_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
zlib_test.ts perf(ext/node): improve Buffer from string performance (#24567) 2024-07-30 18:09:55 +05:30