1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00
denoland-deno/ext/node/polyfills/internal
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
..
console refactor: Use virtul ops module (#22175) 2024-01-29 22:02:26 +01:00
crypto fix(ext/node): rewrite digest handling (#24392) 2024-07-05 10:10:22 +02:00
dns chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
fs fix(ext/node): Add fs.lutimes / fs.lutimesSync (#23172) 2024-07-02 19:33:32 -07:00
process refactor: use core.ensureFastOps() (#21888) 2024-01-10 15:37:25 -07:00
readline chore: upgrade to dprint 0.39 (#19768) 2023-07-08 18:34:08 +00:00
streams refactor: remove dead code in node stream polyfill (#23597) 2024-04-29 19:55:51 +09:00
test chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
util fix(ext/node): support NODE_DEBUG env (#23583) 2024-04-29 09:36:53 +00:00
assert.mjs refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041) 2023-03-08 12:44:54 +01:00
async_hooks.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
blocklist.mjs feat(ext/node): add BlockList & SocketAddress classes (#24229) 2024-06-18 10:46:13 +00:00
buffer.d.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
buffer.mjs perf(ext/node): improve Buffer from string performance (#24567) 2024-07-30 18:09:55 +05:30
child_process.ts fix(ext/node): support stdin child_process IPC & fd stdout/stderr (#24106) 2024-06-07 22:51:32 +05:30
cli_table.ts chore: sync up Node.js test files for v20.11.1 (#24066) 2024-06-11 11:41:44 +00:00
constants.ts refactor: use core.ensureFastOps() (#21888) 2024-01-10 15:37:25 -07:00
dgram.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
dtrace.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
error_codes.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
errors.ts fix(node): Run node compat tests listed in the ignore field (and fix the ones that fail) (#24631) 2024-07-24 03:12:08 +00:00
event_target.mjs chore: upgrade to dprint 0.39 (#19768) 2023-07-08 18:34:08 +00:00
fixed_queue.ts fix(ext/node): make next tick queue resilient to Array.prototype tampering (#24361) 2024-06-27 21:45:46 +00:00
hide_stack_frames.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
http.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
idna.ts fix(ext/node): Match punycode module behavior to node (#22847) 2024-03-11 15:49:43 -07:00
net.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
normalize_encoding.mjs chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
options.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
primordials.mjs feat(node): implement fs.statfs() (#22862) 2024-03-13 10:57:59 +00:00
querystring.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
stream_base_commons.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
timers.mjs fix(ext/node): spread args in setImmediate (#22998) 2024-03-20 07:52:50 +00:00
url.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
util.mjs fix(ext/node): better support for node:diagnostics_channel module (#24088) 2024-06-15 00:07:02 +02:00
validators.mjs chore: sync up Node.js test files for v20.11.1 (#24066) 2024-06-11 11:41:44 +00:00