Commit graph

1078 commits

Author SHA1 Message Date
Leo Kettmeir b31cf9fde6
refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
Divy Srivastava d856bfd336
perf(ext/web): fast path for ws events (#18905)
- Do not use `ReflectHas` in `isNode`.
- Avoid copying handler array when handlers.length == 1
- Avoid searching for path target when path.length == 1

```
Linux divy-2 5.19.0-1022-gcp #24~22.04.1-Ubuntu SMP Sun Apr 23 09:51:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
32GiB System memory
Intel(R) Xeon(R) CPU @ 3.10GHz

# main + https://github.com/denoland/deno/pull/18904
Msg/sec: 89326.750000
Msg/sec: 90320.000000
Msg/sec: 89576.250000

# this patch
Msg/sec: 97250.000000
Msg/sec: 97125.500000
Msg/sec: 97964.500000
```
2023-05-01 10:39:30 +05:30
Divy Srivastava 314799bc4f
perf(ext/websocket): use internal dispatch for msg events (#18904)
```
Linux divy-2 5.19.0-1022-gcp #24~22.04.1-Ubuntu SMP Sun Apr 23 09:51:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
32GiB System memory
Intel(R) Xeon(R) CPU @ 3.10GHz

# main
Msg/sec: 89398.250000
Msg/sec: 90079.750000

# this patch
Msg/sec: 91919.750000
Msg/sec: 91762.250000
```
2023-04-30 12:24:56 +02:00
Kenta Moriuchi 74bb09aa38
fix(ext/url): throw TypeError for empty argument (#18896)
Fixes #18893
2023-04-30 12:24:34 +02:00
Leo Kettmeir 59825a95b4
refactor: remove ext/console/01_colors.js (#18927) 2023-04-30 09:11:37 +00:00
Matt Mastracci bb1f5e4262
perf(core): async op pseudo-codegen and performance work (#18887)
Performance:

```
async_ops.js: 760k -> 1030k (!)
async_ops_deferred.js: 730k -> 770k
Deno.serve bench: 118k -> 124k
WS test w/ third_party/prebuilt/mac/load_test 100 localhost 8000 0 0: unchanged

Startup time: approx 0.5ms slower (13.7 -> 14.2ms)
```
2023-04-30 08:50:24 +00:00
Leo Kettmeir 9c8ebce3dc
refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
Luca Casonato 1066490847
fix(ext/kv): stricter structured clone serializer (#18914) 2023-04-29 17:43:07 +02:00
Igor Zinkovsky 10ae5ee265
fix(ext/io) several sync fs fixes (#18886)
2 fixes related to sync fs:
* update the 2 sync methods on `Resource` trait to take `Rc<Self>`
(consistent with other methods)
* fix a bug in `StdFileResource::with_inner_and_metadata`, which
currently can trigger a panic if a sync method is called on a file with
a pending async operation. This could happen in the code path where
`File::try_clone`
[fails](39ece1fe0d/ext/io/lib.rs (L485-L489)).
2023-04-28 12:16:17 -07:00
denobot 6369098ad7
chore: forward v1.33.1 release commit to main (#18897)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 21:14:26 +02:00
Divy Srivastava 8739519ebc
fix(ext/websocket): client connect URI (#18892) 2023-04-28 18:00:27 +02:00
Bartek Iwańczuk 142c1ab9fc
fix(ext/websocket): restore op_ws_send_ping (#18891)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-28 16:48:00 +02:00
Luca Casonato 84b921555f
fix(ext/fetch): subview Uint8Array in Req/Resp (#18890) 2023-04-28 14:26:21 +02:00
denobot 39ece1fe0d
1.33.0 (#18879)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 01:18:57 +02:00
Levente Kurusa c3d670dbc9
feat(node/crypto): Elliptic Curve Diffie-Hellman (ECDH) support (#18832)
- ECDH class
- crypto.createECDH()
- Supported curves:
  - secp256k1
  - prime256v1 / secp256r1
  - secp384r1
  - secp224r1

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-27 18:31:35 +02:00
Luca Casonato 3fbb31c3c1
feat(kv): return ok bool from atomic commit (#18873) 2023-04-27 16:59:02 +02:00
Divy Srivastava b0264bea7d
fix(ext/node): prime generation (#18861)
Towards https://github.com/denoland/deno/issues/18455

`safe`, `add` and `rem` options are not implemented because there is no
rust crate that provides this functionality (except rust-openssl maybe)
and its just not clear if this API is used widely.
2023-04-27 19:40:59 +05:30
David Sherret 742cc3111c
refactor(cli): extract out ProcState from CliMainWorker (#18867) 2023-04-27 10:05:20 -04:00
Bartek Iwańczuk d043a6d72c
perf(ext/websocket): various performance improvements (#18862)
- No need to wrap buffer in a `new DataView()`
- Deferred ops are still eagerly polled, but resolved on the next
tick of the event loop, we don't want them to be eagerly polled
- Using "core.opAsync"/"core.opAsync2" incurs additional cost
of looking up these functions on each call. Similarly with "ops.*"

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-27 12:47:52 +02:00
Bartek Iwańczuk 1e331a4873
refactor(ext/node): migrate back to using "Deno.serve" API for HTTP server (#18865)
This commit fixes "node:http" API to properly handle "upgrade"
requests and thus marking Vite work again.

This is done by migrating back to "Deno.serve()" and internal
"upgradeHttpRaw" APIs for "node:http" module polyfill.
2023-04-27 12:45:13 +02:00
David Sherret f4e442da4d
fix(dts): URLPatternComponentResult groups should have possibly undefined key values (#18643)
Closes #18640
2023-04-26 19:15:25 -04:00
Matt Mastracci e2761df3fe
fix(ext/http): internal upgradeHttpRaw works with "Deno.serve()" API (#18859)
Fix internal "upgradeHttpRaw" API restoring capability to upgrade HTTP
connection in polyfilles "node:http" API.
2023-04-27 00:58:18 +02:00
David Sherret a8b4e346b4
refactor(ext/node): use a snapshottable global name for Node's globalThis (#18860) 2023-04-26 18:53:13 -04:00
Ryan Dahl 2df6db36c8
feat(ext/kv): add more atomic operation helpers (#18854)
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-04-26 17:14:01 +00:00
Divy Srivastava 5f7db93d0b
perf(ext/http): optimize away code based on callback length (#18849)
hello world on macOS:

```
divy@mini ~> wrk -d 10s --latency http://127.0.0.1:4500
Running 10s test @ http://127.0.0.1:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    80.82us   42.95us   2.91ms   96.40%
    Req/Sec    56.91k     1.94k   60.77k    95.54%
  Latency Distribution
     50%   77.00us
     75%   89.00us
     90%  105.00us
     99%  146.00us
  1143455 requests in 10.10s, 138.49MB read
Requests/sec: 113212.38
Transfer/sec:     13.71MB

divy@mini ~> wrk -d 10s --latency http://127.0.0.1:4500
Running 10s test @ http://127.0.0.1:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    88.63us   78.77us   2.55ms   98.72%
    Req/Sec    54.84k     2.16k   57.35k    98.51%
  Latency Distribution
     50%   80.00us
     75%   93.00us
     90%  109.00us
     99%  249.00us
  1102313 requests in 10.10s, 133.51MB read
Requests/sec: 109136.61
Transfer/sec:     13.22MB
```

Expected to have a larger impact on Linux
2023-04-26 22:11:54 +05:30
Bartek Iwańczuk 17d1c7e444
Revert "chore(ext/websocket): Add autobahn|testsuite fuzzingclient (#… (#18856)
…18846)"

This reverts commit 036778c2e8.

Keeps failing on `main` branch.
2023-04-26 15:48:23 +00:00
Matt Mastracci 38681dfa88
perf(ext/http): optimize for zero or one-packet response streams (#18834)
Improve `deno_reactdom_ssr_flash.jsx` by optimizing for zero/one-packet response streams.
2023-04-26 15:33:30 +02:00
Bartek Iwańczuk 1b450015e7
BREAKING(unstable): remove "Deno.serve(handler, options)" overload (#18759)
In preparation to stabilization of the API this overload was decided to
be removed.
2023-04-26 14:54:03 +02:00
Divy Srivastava 036778c2e8
chore(ext/websocket): Add autobahn|testsuite fuzzingclient (#18846)
Closes #17242
2023-04-26 17:55:48 +05:30
Divy Srivastava fbefceeb56
perf(ext/http): use smi for slab IDs (#18848) 2023-04-26 15:38:13 +05:30
Divy Srivastava 18170f2326
perf(ext/http): avoid spread arg deopt in op_http_wait (#18850)
2% improvement on macOS hello world.
2023-04-26 15:37:57 +05:30
Divy Srivastava 9d7e3f84c8
chore(ext/websocket): remove ping frame handling (#18847)
Automatically done in the fastwebsockets crate
2023-04-26 15:37:38 +05:30
David Sherret 041d1e093b
refactor(cli): extract out NpmModuleLoader from CliModuleLoader (#18842)
Need to share this with the loader used in deno compile
2023-04-25 18:36:31 -04:00
Kenta Moriuchi 9b49de4644
fix(core): Wrap safe collections' argument of primordials (#18750) 2023-04-26 00:36:22 +02:00
Bartek Iwańczuk 97820fe8ab
refactor(ext/kv): don't use bigint literals (#18841)
This causes `DCHECK` fail in V8 when pointer compression
is disabled.
2023-04-25 20:43:39 +00:00
Bartek Iwańczuk 531754c354
refactor(ext/websocket): use specialized ops (#18819)
Instead of relying on `op_ws_send` to send different kinds of messages,
use specialized ops everywhere.
2023-04-25 13:53:06 +02:00
Matt Mastracci 21c888d4db
refactor(ext/http): comments for h2c code (#18833) 2023-04-25 12:41:01 +02:00
Yoshiya Hinosawa 63befe9377
fix(ext/node): fix hash.flush (#18818) 2023-04-25 11:21:26 +09:00
David Sherret 5b4a9b48ae
refactor(ext/node): enforce interior mutable for NodePermissions to remove clones (#18831)
We can make `NodePermissions` rely on interior mutability (which the
`PermissionsContainer` is already doing) in order to not have to clone
everything all the time. This also reduces the chance of an accidental
`borrow` while `borrrow_mut`.
2023-04-24 21:07:48 -04:00
David Sherret aa286fdecb
refactor(ext/node): allow injecting NodeFs from CLI (#18829)
This allows providing a `NodeFs` as part of the `WorkerOptions`.
2023-04-24 19:44:35 -04:00
Matt Mastracci bb74e75a04
feat(ext/http): h2c for http/2 (#18817)
This implements HTTP/2 prior-knowledge connections, allowing clients to
request HTTP/2 over plaintext or TLS-without-ALPN connections. If a
client requests a specific protocol via ALPN (`h2` or `http/1.1`),
however, the protocol is forced and must be used.
2023-04-24 23:24:40 +02:00
David Sherret 0e97fa4d5f
fix(npm): only include top level packages in top level node_modules directory (#18824)
We were indeterministically including packages in the top level
`node_modules/` folder when using a local node_modules directory. This
change aligns with pnpm and only includes top level packages in this
folder. This should be faster for initializing the folder, but may
expose issues in packages that reference other packages not defined in
their dependencies. That said, the behaviour previously was previously
broken.

This has exposed a bug in the require implementation where it doesn't
find a package (which is the main underlying issue here). There is a
failing test already for this in the test suite after this change.

Closes #18822

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-24 17:08:11 -04:00
Bartek Iwańczuk 1f0360c073
refactor(ext/node): reorganize ops (#18799)
Move all op related code of "ext/node" to "ext/node/ops" module.

These files were unnecessarily scattered around the extension.
2023-04-24 12:22:21 +02:00
Bartek Iwańczuk 28e2c7204f
chore: remove tokio-tungstenite dependency (#18814) 2023-04-23 23:56:55 -04:00
Matt Mastracci fafb2584ef
refactor(ext/websocket): Remove dep on tungstenite by reworking code (#18812) 2023-04-23 14:07:37 -06:00
Matt Mastracci 13f7f8c415
fix(ext/http): ensure that multiple upgrades and multiple simultaneous requests cannot cause a panic (#18810)
Fix a bug where we weren't saving `slabId` in #18619, plus add some
robustness checks around multiple upgrades (w/test).
2023-04-23 09:59:46 -06:00
Matt Mastracci bdffcb409f
feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619)
This is a rewrite of the `Deno.serve` API to live on top of hyper
1.0-rc3. The code should be more maintainable long-term, and avoids some
of the slower mpsc patterns that made the older code less efficient than
it could have been.

Missing features:

- `upgradeHttp` and `upgradeHttpRaw` (`upgradeWebSocket` is available,
however).
- Automatic compression is unavailable on responses.
2023-04-22 11:48:21 -06:00
Levente Kurusa d137501a63
feat(node/http): implement ClientRequest.setTimeout() (#18783)
- implement setTimeout with matching semantics of Node
- add the test from Node but leave it turned off because ClientRequest
has no underlying socket
2023-04-22 13:20:00 +02:00
Bartek Iwańczuk 068228cb45
refactor: rewrite tests to "fastwebsockets" crate (#18781)
Migrating off of `tokio-tungstenite` crate.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-22 11:17:31 +02:00
David Sherret a615eb3b56
refactor(node): move most of cli/node to ext/node (#18797)
This is just a straight refactor and I didn't do any cleanup in
ext/node. After this PR we can start to clean it up and make things
private that don't need to be public anymore.
2023-04-21 21:02:46 -04:00