1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-09 23:58:23 -05:00
denoland-deno/ext
Marcos Casagrande 18bf1cc309 perf(ext/urlpattern): optimize URLPattern.exec (#20170)
This PR optimizes `URLPattern.exec` 

- Use component keys from constructor instead of calling it on every
`.exec`. AFAIK keys should always be
`protocol`,`username`,`password`,`hostname`,`port`,`pathname`,`search`,`hash`.
Haven't looked much into it but I think it's safe to define these
outside the constructor as well.
- Add a fast path for `/^$/u` (default regexp) and empty input
- Replaced `ArrayPrototypeMap` & `ObjectFromEntries` with a `for` loop.


**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
exec 1          2.17 µs/iter     461,022.8     (2.14 µs … 2.27 µs)   2.18 µs   2.27 µs   2.27 µs
exec 2          4.13 µs/iter     242,173.4     (4.08 µs … 4.27 µs)   4.15 µs   4.27 µs   4.27 µs
exec 3          2.55 µs/iter     391,508.1     (2.53 µs … 2.68 µs)   2.56 µs   2.68 µs   2.68 µs
```

**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
exec 1          2.45 µs/iter     408,092.4     (2.41 µs … 2.55 µs)   2.46 µs   2.55 µs   2.55 µs
exec 2          4.41 µs/iter     226,706.0   (3.49 µs … 399.56 µs)   4.39 µs   5.49 µs   6.07 µs
exec 3          2.99 µs/iter     334,833.4     (2.94 µs … 3.21 µs)   2.99 µs   3.21 µs   3.21 µs
```
2023-08-21 17:00:45 +05:30
..
broadcast_channel 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
cache refactor(ext/cache): Remove custom shutdown and use fast async ops (#20107) 2023-08-09 17:45:35 +00:00
console 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
crypto 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
fetch perf(ext/node): optimize http headers (#20163) 2023-08-21 17:00:44 +05:30
ffi 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
fs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00
http perf(http): use Cow<[u8]> for setting header (#20112) 2023-08-21 17:00:44 +05:30
io chore: deno_core -> 0.201.0 (#20135) 2023-08-21 17:00:44 +05:30
kv 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
napi 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
net fix(ext/net): implement a graceful error on an invalid SSL certificate (#20157) 2023-08-21 17:00:44 +05:30
node fix(ext/node): allow for the reassignment of userInfo() on Windows (#20165) 2023-08-21 17:00:45 +05:30
tls 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
url perf(ext/urlpattern): optimize URLPattern.exec (#20170) 2023-08-21 17:00:45 +05:30
web fix(ext/fetch): clone second branch chunks in Body.clone() (#20057) 2023-08-21 17:00:44 +05:30
webidl 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
websocket chore: upgrade fastwebsockets to 0.4.4 (#19089) 2023-08-10 09:59:06 +05:30
webstorage 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00