1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

66 commits

Author SHA1 Message Date
Nathan Whitaker
a61ba3c699
fix(net): don't try to set nodelay on upgrade streams (#26342)
Fixes https://github.com/denoland/deno/issues/26341.

We try to call `op_set_nodelay` on an `UpgradeStream`, which doesn't
support that operation.
2024-10-17 03:56:57 +00:00
Asher Gomez
4865ae13e1
BREAKING(net): remove Deno.[Tls]Listener.prototype.rid (#25556)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-11 01:14:50 +02:00
Asher Gomez
a9ed06b832
BREAKING(net): remove Deno.{Conn,TlsConn,TcpConn,UnixConn}.prototype.rid (#25446)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-06 23:01:36 +00:00
Kenta Moriuchi
f0a3d20642
fix(runtime): use more null proto objects again (#25040)
proceed with #23921

This PR is a preparation for
https://github.com/denoland/deno_lint/pull/1307

---------

Signed-off-by: Kenta Moriuchi <moriken@kimamass.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-09-06 12:52:59 +02:00
Asher Gomez
a527b3a5de
chore(net): remove Deno.shutdown() (#25253) 2024-08-31 09:46:02 +10:00
seb
a3a54bc747
fix(ext/net): validate port in Deno.{connect,serve,listen} (#24399)
Co-authored-by: Will Leach <4619280+melbourne2991@users.noreply.github.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 21:25:41 +00:00
Nathan Whitaker
e92a05b551
feat(serve): Opt-in parallelism for deno serve (#24920)
Adds a `parallel` flag to `deno serve`. When present, we spawn multiple
workers to parallelize serving requests.


```bash
deno serve --parallel main.ts
```

Currently on linux we use `SO_REUSEPORT` and rely on the fact that the
kernel will distribute connections in a round-robin manner.

On mac and windows, we sort of emulate this by cloning the underlying
file descriptor and passing a handle to each worker. The connections
will not be guaranteed to be fairly distributed (and in practice almost
certainly won't be), but the distribution is still spread enough to
provide a significant performance increase.

---
(Run on an Macbook Pro with an M3 Max, serving `deno.com`

baseline::
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   239.78ms   13.56ms 330.54ms   79.12%
    Req/Sec   258.58     35.56   360.00     70.64%
  Latency Distribution
     50%  236.72ms
     75%  248.46ms
     90%  256.84ms
     99%  268.23ms
  15458 requests in 30.02s, 2.47GB read
Requests/sec:    514.89
Transfer/sec:     84.33MB
```

this PR (`with --parallel` flag)
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   117.40ms  142.84ms 590.45ms   79.07%
    Req/Sec     1.33k   175.19     1.77k    69.00%
  Latency Distribution
     50%   22.34ms
     75%  223.67ms
     90%  357.32ms
     99%  460.50ms
  79636 requests in 30.07s, 12.74GB read
Requests/sec:   2647.96
Transfer/sec:    433.71MB
```
2024-08-14 22:26:21 +00:00
Andrew Johnston
26bf4480ff
fix(net): set correct max size for Datagram (#21611) 2024-07-10 03:30:22 +00:00
Asher Gomez
49f6e2e79e
FUTURE(ext/net): remove Deno.(Conn|TlsConn|Listener|TlsListener|UnixConn).prototype.rid (#23219)
Towards #23089

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-04-08 08:59:37 +10:00
Asher Gomez
b9f8562754
chore: rename internal Datagram class to DatagramConn (#22474)
As having mismatched public and private class names may be confusing,
without good reason, to those unfamiliar with the codebase.
2024-03-19 18:03:15 +01:00
Asher Gomez
7531b3500a
BREAKING(net/unstable): remove Deno.DatagramConn.rid (#22475)
As part of ongoing efforts to remove `rid` properties from the public
API. Note: this property is undocumented.
2024-02-19 05:24:38 +00:00
Asher Gomez
b651990684
chore: cleanup obsolete Datagram export (#22078)
This isn't used anywhere outside the originating file.
2024-02-13 12:55:17 -07:00
Bartek Iwańczuk
043fee48fd
chore: upgrade deno_core to 0.259.0 (#22311)
This update brings number of ops available to user code down to 45.
2024-02-07 02:16:08 +01:00
Bartek Iwańczuk
345423cf76
refactor: Use virtul ops module (#22175)
Follow up to #22157.

This leaves us with 4 usages of `ensureFastOps()` in `deno` itself.
There's also about 150 usages of `Deno.core.ops.<op_name>` left as well.
2024-01-29 22:02:26 +01:00
Bartek Iwańczuk
462ce14a78
refactor: migrate extensions to virtual ops module (#22135)
First pass of migrating away from `Deno.core.ensureFastOps()`.

A few "tricky" ones have been left for a follow up.
2024-01-26 23:46:46 +01:00
Bartek Iwańczuk
6109717c4a
refactor: make 'rid' properties non-enumerable (#22137)
Now these props will not show up when inspecting objects in console.
2024-01-26 23:19:00 +01:00
Bartek Iwańczuk
942fb5e038
chore: upgrade deno_core (#22124)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-26 14:04:07 -05:00
Bartek Iwańczuk
174bb70eda
fix: don't use public rid accessors in internal APIs (#22091)
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-25 00:45:19 +01:00
Asher Gomez
fc176c4dea
feat: deprecate Deno.{Conn,TcpConn,TlsConn,UnixConn}.rid (#22077)
For removal in Deno v2.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24 22:12:10 +01:00
Asher Gomez
abaffad028
feat: deprecate Deno.Listener.rid (#22076)
For removal in Deno v2.
2024-01-24 18:52:55 +01:00
Kenta Moriuchi
515a34b4de
refactor: use core.ensureFastOps() (#21888) 2024-01-10 15:37:25 -07:00
Divy Srivastava
ad65440092
fix(ext/node): UdpSocket ref and unref (#21777) 2024-01-04 08:51:39 +05:30
David Sherret
7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Matt Mastracci
0efe438f7c
perf: remove opAsync (#21690)
`opAsync` requires a lookup by name on each async call. This is a
mechanical translation of all opAsync calls to ensureFastOps.

The `opAsync` API on Deno.core will be removed at a later time.
2023-12-27 02:30:26 +01:00
Bartek Iwańczuk
c1fc7b2cd5
refactor: pull 'core', 'internals', 'primordials' from ES module (#21462)
This commit refactors how we access "core", "internals" and
"primordials" objects coming from `deno_core`, in our internal JavaScript code.

Instead of capturing them from "globalThis.__bootstrap" namespace, we
import them from recently added "ext:core/mod.js" file.
2023-12-07 14:21:01 +01:00
Matt Mastracci
9010b8df53
perf: remove knowledge of promise IDs from deno (#21132)
We can move all promise ID knowledge to deno_core, allowing us to better
experiment with promise implementation in deno_core.

`{un,}refOpPromise(promise)` is equivalent to
`{un,}refOp(promise[promiseIdSymbol])`
2023-11-09 13:57:26 -07:00
Luca Casonato
d42f154312
feat: disposable Deno resources (#20845)
This commit implements Symbol.dispose and Symbol.asyncDispose for
the relevant resources.

Closes #20839

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-01 20:26:12 +01:00
Yoshiya Hinosawa
da0b945804
feat(unstable): add unix domain socket support to Deno.serve (#20759) 2023-10-04 11:37:39 +09:00
Yoshiya Hinosawa
3d35900639
fix(ext/net): fix string port number handling in listen (#19921)
While string `port` is not allowed in typing, it seems we used to
support that and now it's broken. ref:
https://github.com/denoland/deno/issues/10064#issuecomment-1637427260

This PR restores the support of string port number in `listen` and
`listenTls`
2023-07-25 06:26:18 +00:00
Kenta Moriuchi
6728ad4203
fix(core): Use primordials for methods (#18839)
I would like to get this change into Deno before merging
https://github.com/denoland/deno_lint/pull/1152
2023-05-01 15:30:02 +02:00
Sam Gwilym
4c34a2f2df
feat(ext/net): Add multicasting APIs to DatagramConn (#10706) (#17811) 2023-03-20 22:27:00 +01:00
Bartek Iwańczuk
72fe9bb470
refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041)
This commit renames "deno_core::InternalModuleLoader" to
"ExtModuleLoader" and changes the specifiers used by the 
modules loaded from this loader to "ext:".

"internal:" scheme was really ambiguous and it's more characters than
"ext:", which should result in slightly smaller snapshot size.

Closes https://github.com/denoland/deno/issues/18020
2023-03-08 12:44:54 +01:00
Leo Kettmeir
a55f0eb2fc
feat: add signal option to Deno.resolveDns (#17384)
Closes #14406
2023-02-11 14:14:02 +00:00
Leo Kettmeir
49af1ab18d
refactor: remove prefix from include_js_files & use extension name (#17683) 2023-02-07 21:09:50 +00:00
Leo Kettmeir
b4aa153097
refactor: Use ES modules for internal runtime code (#17648)
This PR refactors all internal js files (except core) to be written as
ES modules.
`__bootstrap`has been mostly replaced with static imports in form in
`internal:[path to file from repo root]`.
To specify if files are ESM, an `esm` method has been added to
`Extension`, similar to the `js` method.
A new ModuleLoader called `InternalModuleLoader` has been added to
enable the loading of internal specifiers, which is used in all
situations except when a snapshot is only loaded, and not a new one is
created from it.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-07 20:22:46 +01:00
Bartek Iwańczuk
da23f7f876
feat: Stabilize Deno.Listener.ref/unref (#17477) 2023-01-20 16:32:55 +01:00
Kenta Moriuchi
6da958d7ec
chore: update dlint to v0.37.0 for GitHub Actions (#17295)
Updated third_party dlint to v0.37.0 for GitHub Actions. This PR
includes following changes:
 
* fix(prefer-primordials): Stop using array pattern assignments
* fix(prefer-primordials): Stop using global intrinsics except for
`SharedArrayBuffer`
* feat(guard-for-in): Apply new guard-for-in rule
2023-01-16 17:17:18 +01:00
David Sherret
10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
Bartek Iwańczuk
bece1ce057
feat(unstable): Add Deno.Conn.ref()/unref() (#17170)
This commit adds "Deno.Conn.ref()" and "Deno.Conn.unref()" methods.

These methods can be used to make connection block or not block the
event loop from finishing. Refing/unrefing only influences "read" 
operations - ie. scheduling writes to a connection _do_ keep event 
loop alive.

Required for https://github.com/denoland/deno/issues/16710
2022-12-28 10:29:48 +01:00
Bartek Iwańczuk
f9db129bdf
feat: Stabilize Deno.TcpConn.setNoDelay() and Deno.TcpConn.setKeepAlive() (#17003)
This commit stabilizes following APIs:
- `Deno.TcpConn.setNoDelay()`
- `Deno.TcpConn.setKeepAlive()`
2022-12-14 00:54:11 +01:00
Bartek Iwańczuk
8d5c0112fb
feat: don't require --unstable flag for npm programs (#16520)
This PR adds copies of several unstable APIs that are available
in "Deno[Deno.internal].nodeUnstable" namespace.

These copies do not perform unstable check (ie. don't require
"--unstable" flag to be present). Otherwise they work exactly
the same, including permission checks.

These APIs are not meant to be used by users directly and
can change at any time.

Copies of following APIs are available in that namespace:
- Deno.spawnChild
- Deno.spawn
- Deno.spawnSync
- Deno.serve
- Deno.upgradeHttpRaw
- Deno.listenDatagram
2022-11-10 22:03:28 +01:00
Luca Casonato
f4f1f4f0b6
feat(ext/net): reusePort for TCP on Linux (#16398) 2022-10-26 19:04:27 +00:00
Bartek Iwańczuk
af62e0833d
Revert "Revert "refactor(ext/net): clean up variadic network ops (#16… (#16422)
…392)" (#16417)"

This reverts commit 8e3f825c92.
2022-10-25 22:50:55 +02:00
Bartek Iwańczuk
8e3f825c92
Revert "refactor(ext/net): clean up variadic network ops (#16392)" (#16417)
Should fix https://github.com/denoland/deno_std/issues/2807
2022-10-25 20:32:51 +02:00
Luca Casonato
c061538417
refactor(ext/net): clean up variadic network ops (#16392)
Previously `op_net_listen`, `op_net_accept`, and various other ops in
ext/net where variadic on the transport. This created a lot of code
bloat. This commit updates the code to instead have separate ops for
each transport.
2022-10-24 14:55:39 +02:00
Luca Casonato
1ab3691b09
feat(core): add Deno.core.writeAll(rid, chunk) (#16228)
This commit adds a new op_write_all to core that allows writing an
entire chunk in a single async op call. Internally this calls
`Resource::write_all`.

The `writableStreamForRid` has been moved to `06_streams.js` now, and
uses this new op. Various other code paths now also use this new op.

Closes #16227
2022-10-10 10:28:35 +02:00
Luca Casonato
38f544538b
fix(runtime): no FastStream for unrefable streams (#16095) 2022-09-30 00:42:33 +02:00
Aapo Alasuutari
2164f6b1eb
perf(ops): Monomorphic sync op calls (#15337)
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params).

Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple:

```
opSync("op_foo", param1, param2);
// -> turns to
ops.op_foo(param1, param2);
```

This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path.

Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-08-11 15:56:56 +02:00
Divy Srivastava
57f7e07c13
Reland "perf(http): optimize ReadableStreams backed by a resource" (#14346) 2022-04-22 16:19:08 +05:30
Bartek Iwańczuk
03019e7781
Revert various PRs related to "ext/http" (#14339)
* Revert "feat(ext/http): stream auto resp body compression (#14325)"
* Revert "core: introduce `resource.read_return` (#14331)"
* Revert "perf(http): optimize `ReadableStream`s backed by a resource (#14284)"
2022-04-21 02:22:55 +02:00