0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-09 13:49:37 -04:00
deno/ext
Divy Srivastava 98ecb562d0
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
```

(cherry picked from commit 1ba88a7892)
2024-07-31 20:26:53 +02:00
..
broadcast_channel 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
cache 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
canvas 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
console 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
cron 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
crypto 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
fetch chore: upgrade to rust 1.80 (#24778) 2024-07-31 20:26:27 +02:00
ffi chore: upgrade to rust 1.80 (#24778) 2024-07-31 20:26:27 +02:00
fs 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
http fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698) 2024-07-31 20:26:17 +02:00
io 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
kv 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
napi 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
net 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
node perf(ext/node): improve Buffer from string performance (#24567) 2024-07-31 20:26:53 +02:00
node_resolver fix(unstable/compile): handle byonm import in sub dir (#24755) 2024-07-31 20:25:33 +02:00
tls 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
url 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
web perf(ext/node): improve Buffer from string performance (#24567) 2024-07-31 20:26:53 +02:00
webgpu chore: upgrade to rust 1.80 (#24778) 2024-07-31 20:26:27 +02:00
webidl 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
websocket 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00
webstorage 1.45.4 (#24751) 2024-07-26 12:38:02 -04:00