Marcos Casagrande
38d4b379fd
perf(ext/web): optimize DOMException ( #20715 )
...
This PR optimizes `DOMException` constructor increasing performance of
all Web APIs that throw a `DOMException` (ie: `AbortSignal`)
**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
new DOMException() 9.66 µs/iter 103,476.8 (8.47 µs … 942.71 µs) 9.62 µs 11.29 µs 14.04 µs
abort writeTextFileSync 16.45 µs/iter 60,775.5 (13.65 µs … 1.33 ms) 16.39 µs 20.59 µs 24.12 µs
abort readFile 16.25 µs/iter 61,542.2 (15.12 µs … 621.14 µs) 16.18 µs 19.59 µs 22.33 µs
```
**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------------------- -----------------------------
new DOMException() 2.37 µs/iter 421,657.0 (2.33 µs … 2.58 µs) 2.37 µs 2.58 µs 2.58 µs
abort writeTextFileSync 7.1 µs/iter 140,760.1 (6.94 µs … 7.68 µs) 7.13 µs 7.68 µs 7.68 µs
abort readFile 5.48 µs/iter 182,648.2 (5.3 µs … 5.69 µs) 5.56 µs 5.69 µs 5.69 µ
```
```js
Deno.bench("new DOMException()", () => {
new DOMException();
});
Deno.bench("abort writeTextFileSync", () => {
const ac = new AbortController();
ac.abort();
try {
Deno.writeTextFileSync("/tmp/out", "x", { signal: ac.signal });
} catch {}
});
Deno.bench("abort readFile", async () => {
const ac = new AbortController();
ac.abort();
try {
await Deno.readFile("/tmp/out", { signal: ac.signal });
} catch {}
});
```
2023-10-13 00:39:30 +02:00
David Sherret
6a85593392
refactor(npm): create cli::npm::managed
module ( #20740 )
...
Creates the `cli::npm::managed` module and starts moving more
functionality into it.
2023-10-13 00:39:30 +02:00
Divy Srivastava
e79da1679e
perf(node): use faster utf8 byte length in Buffer#from ( #20746 )
...
Use the `core.byteLength` op for string utf8 length calculation in
`node:buffer`
```
# This patch
file:///Users/divy/gh/deno/buffer.mjs
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------- -----------------------------
Buffer#from 272.11 ns/iter 3,675,029.3 (268.41 ns … 301.15 ns) 271.62 ns 295.5 ns 301.15 ns
# Deno 1.37.1
file:///Users/divy/gh/deno/buffer.mjs
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------- -----------------------------
Buffer#from 411.28 ns/iter 2,431,428.8 (393.82 ns … 439.92 ns) 418.85 ns 434.4 ns 439.92 ns
```
2023-10-13 00:39:30 +02:00
Rui He
554b7792b4
feat(node/os): Add availableParallelism
( #20745 )
2023-10-13 00:39:29 +02:00
Hirotaka Tagawa / wafuwafu13
e178ac6a9e
test(node_compat): add test-http-url.parse*
( #20458 )
...
Add `test-http-url.parse*` tests for Node compat.
2023-10-13 00:39:29 +02:00
Trevor Manz
cf3229a4aa
feat(jupyter): send Jupyter messaging metadata with Deno.jupyter.broadcast
( #20714 )
...
Exposes
[`metadata`](https://jupyter-client.readthedocs.io/en/latest/messaging.html#metadata )
to the `Deno.jupyter.broadcast` API.
```js
await Deno.jupyter.broadcast(msgType, content, metadata);
```
The metadata is required for
[`"comm_open"`](https://github.com/jupyter-widgets/ipywidgets/blob/main/packages/schema/messages.md#instantiating-a-widget-object-1 )
for with `jupyter.widget` target.
2023-10-13 00:39:29 +02:00
Nayeem Rahman
63ba58239c
feat(lsp): jupyter notebook analysis ( #20719 )
2023-10-13 00:39:29 +02:00
Igor Zinkovsky
9ce3b22bd4
fix(ext/kv): send queue wake messages accross different kv instances ( #20465 )
...
fixes #20454
Current KV queues implementation assumes that `enqueue` and
`listenQueue` are called on the same instance of `Deno.Kv`. It's
possible that the same Deno process opens multiple KV instances pointing
to the same fs path, and in that case `listenQueue` should still get
notified of messages enqueued through a different KV instance.
2023-10-13 00:39:29 +02:00
David Sherret
3b01e3fa8b
refactor(cli): make CliNpmResolver
a trait ( #20732 )
...
This makes `CliNpmResolver` a trait. The terminology used is:
- **managed** - Deno manages the node_modules folder and does an
auto-install (ex. `ManagedCliNpmResolver`)
- **byonm** - "Bring your own node_modules" (ex. `ByonmCliNpmResolver`,
which is in this PR, but unimplemented at the moment)
Part of #18967
2023-10-13 00:39:28 +02:00
David Sherret
8d851c95ec
refactor(ext/node): remove dependency on deno_npm and deno_semver ( #20718 )
...
This is required from BYONM (bring your own node_modules).
Part of #18967
2023-10-13 00:39:28 +02:00
Bartek Iwańczuk
a913a54656
fix(jupyter): more robust Deno.jupyter namespace ( #20710 )
2023-10-13 00:39:28 +02:00
David Sherret
f5243f1dbd
fix(upgrade): use tar.exe to extract on Windows ( #20711 )
...
This is what we do for deno install, so it should be fine here
https://github.com/denoland/deno_install/pull/219
Closes https://github.com/denoland/deno/issues/20683
2023-10-13 00:39:28 +02:00
David Sherret
3f7207d1a9
chore: add back dotcom step to release ( #20713 )
...
Accidentally removed in
69b7166c20
2023-10-13 00:39:28 +02:00
Matt Mastracci
ec60b78e77
chore(ext/ffi): migrate part of FFI to op2 ( #20699 )
2023-10-13 00:39:28 +02:00
Chen Su
ae84e01e8a
fix(ext/node): fix TypeError in Buffer.from with base64url encoding. ( #20705 )
...
For the following example, if I set the encoding to `base64url`, it'll
throw an unexpected TypeError:
```ts
import { Buffer } from "node:buffer";
Buffer.from("IntcImhlbGxvXCI6XCJoZGQvZStpXCJ9Ig", "base64url").toString();
// error: Uncaught TypeError: src.subarray is not a function
// const buf = Buffer.from(
// ^
// at blitBuffer (ext:deno_node/internal/buffer.mjs:1779:15)
// at Uint8Array.base64urlWrite (ext:deno_node/internal/buffer.mjs:691:10)
// at Object.write (ext:deno_node/internal/buffer.mjs:2195:11)
// at Uint8Array.write (ext:deno_node/internal/buffer.mjs:794:14)
// at fromString (ext:deno_node/internal/buffer.mjs:214:22)
// at _from (ext:deno_node/internal/buffer.mjs:119:12)
// at Function.from (ext:deno_node/internal/buffer.mjs:157:10)
// at file:///Users/foodieats/temp/buffer1.ts:3:20
```
The error caused by `base64urlWrite` function, it should call
`forgivingBase64UrlDecode` not `forgivingBase64UrlEncode`
Also fixed #20563 .
2023-10-13 00:39:27 +02:00
Luca Casonato
16419c44b8
fix(cli): panic with __runtime_js_sources ( #20704 )
...
Also a drive-by cleanup elsewhere (removing unused enum).
Fixes #20702
2023-10-13 00:39:27 +02:00
denobot
72c276d61a
1.37.1 ( #20703 )
...
Bumped versions for 1.37.1
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-09-27 11:54:44 +05:30
Igor Zinkovsky
f0a022bed4
fix(kv_queues): graceful shutdown ( #20627 )
...
This fixes the `TypeError: Database closed` error during shutdown.
2023-09-26 20:06:57 -07:00
Nayeem Rahman
b433133a1f
fix(lsp): allow query strings for "deno:/status.md" ( #20697 )
2023-09-27 01:48:34 +01:00
Bartek Iwańczuk
46a4bd5178
feat(unstable): add Deno.jupyter.broadcast
API ( #20656 )
...
Closes https://github.com/denoland/deno/issues/20591
---------
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-27 02:21:06 +02:00
Matt Mastracci
d39659332c
chore: update deno_core and cargo update ( #20696 )
...
```
Updating deno_core v0.217.0 -> v0.218.0
Updating deno_ops v0.93.0 -> v0.94.0
Updating deno_semver v0.5.0 -> v0.5.1
Updating fastrand v2.0.0 -> v2.0.1
Updating serde_v8 v0.126.0 -> v0.127.0
Updating sha2 v0.10.7 -> v0.10.8
Updating time v0.3.28 -> v0.3.29
Updating time-core v0.1.1 -> v0.1.2
Updating time-macros v0.2.14 -> v0.2.15
```
2023-09-26 23:38:43 +00:00
David Sherret
91832ce278
fix(upgrade): error instead of panic on unzip failure ( #20691 )
...
For #20683
2023-09-26 17:52:47 -04:00
Nayeem Rahman
cb154d6afa
chore(lsp): bump tower-lsp to 0.20.0 ( #20693 )
2023-09-26 21:57:14 +01:00
David Sherret
dcb00bb9b8
chore: slight cleanup in npm resolvers ( #20692 )
2023-09-26 16:42:39 -04:00
Bartek Iwańczuk
50a3209fff
chore: deprecate Deno.metrics() API ( #20684 )
...
This API is providing hoops to jump through with undergoing migration to
`#[op2]` macro.
The overhead of supporting this API is non-trivial and besides internal
use of it in test sanitizers is very rarely used in the wild.
2023-09-26 17:34:53 +02:00
Bartek Iwańczuk
3c0d6de155
refactor: rewrite ext/node/crypto to op2 macro ( #20675 )
2023-09-26 12:07:04 +00:00
Laurence Rowe
8fcea5966c
refactor(ext/http): use scopeguard defer to handle async drop ( #20652 )
...
Use the [scopeguard](https://docs.rs/scopeguard/ ) defer macro to run
cleanup code for `new_slab_future`.
This means it can be a single async function, avoiding the need to
create a struct and implement `PinnedDrop`
Async cleanup in Rust is awkward because async functions may be
cancelled at any await point when their Future is dropped.
The scopeguard approach comes from the following articles:
* [How to think about `async`/`await` in
Rust](http://cliffle.com/blog/async-inversion/ )
* [Async Cancellation
I](https://blog.yoshuawuyts.com/async-cancellation-1/ ) (Reddit
[discussion](https://www.reddit.com/r/rust/comments/qrhg39/blog_post_async_cancellation/ ))
2023-09-26 05:42:48 -06:00
Luca Casonato
c68650d532
fix(cli/test): clear connection pool after tests ( #20680 )
...
This helps reduce flakes where a test starts an HTTP server and makes a
request using fetch, then shuts down the server, then starting a new
test with a new server, but the connection pool still has a "not quite
closed yet" connection to the old server, and a new request to the new
server gets sent on the closed connection, which obviously errors out.
2023-09-26 19:46:06 +09:00
Luca Casonato
6f87962a77
chore: clean up lint script ( #20682 )
...
Right now, if one of the linters fails, the all other ones continue
running in the background. This fixes this by waiting until all linters
are done before settling.
2023-09-26 04:41:07 +00:00
Nayeem Rahman
939279aa10
feat(lsp): support more vscode built-in settings ( #20679 )
2023-09-26 03:54:07 +01:00
Luca Casonato
8e1304ced4
perf(test): use fast ops for deno test register ( #20670 )
...
Use fast ops for test registration. This speeds up `Deno.test` and
`t.step()` significantly (2x over Deno 1.37.0).
2023-09-26 02:21:18 +00:00
Luca Casonato
a879f8c9fa
test: unflake serve_test/httpServerTcpCancellation ( #20672 )
...
Previously could flake on the op sanitizer because the
`await makeTempFile()` promise could leak out of the test. Now we ensure
the request is fully handled before returning.
2023-09-26 02:12:12 +00:00
Luca Casonato
26f431fd14
perf(test): use core.currentUserCallSite ( #20669 )
...
Speeds up `Deno.test` calls by a bit.
2023-09-26 10:01:56 +09:00
Matt Mastracci
a27ee8f368
fix(ext/http): ensure that resources are closed when request is cancelled ( #20641 )
...
Builds on top of #20622 to fix #10854
2023-09-25 17:23:55 +02:00
Mikko
83f20007aa
docs: fix broken deno manual link ( #20667 )
2023-09-25 14:09:27 +02:00
Nayeem Rahman
bb4b00df92
feat(lsp): cache all dependencies quick fix ( #20665 )
2023-09-24 23:33:52 +01:00
Bartek Iwańczuk
b2abae4771
refactor: rewrite more ops to op2 ( #20666 )
2023-09-24 22:07:22 +00:00
Nayeem Rahman
98ef7bd818
fix(lsp): resolve remote import maps ( #20651 )
2023-09-24 18:00:15 +01:00
Nayeem Rahman
33f84321b2
refactor(lsp): implement "deno.cacheOnSave" server-side ( #20632 )
2023-09-24 17:59:42 +01:00
Aapo Alasuutari
cb9ab9c3ac
fix(ext/node): Fix invalid length variable reference in blitBuffer ( #20648 )
2023-09-24 13:48:23 +03:00
Mikhail
0e2637f851
fix(ext/node): simplified array.from + map ( #20653 )
...
`Array.from` has optional second argument. Calling `map` is not required
for this case.
2023-09-24 11:23:25 +02:00
Nayeem Rahman
d955d66a3f
fix(lsp): show related information for tsc diagnostics ( #20654 )
2023-09-24 08:18:51 +01:00
Igor Zinkovsky
b5ba5f157e
fix(kv): unflake kv unit tests ( #20640 )
...
fixes #20635
2023-09-23 17:59:01 -07:00
Bartek Iwańczuk
68851d6f37
refactor: rewrite ops to op2 macro ( #20628 )
...
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-23 19:33:31 +00:00
Matt Mastracci
65dccc389a
chore: bump deno_core ( #20650 )
2023-09-23 17:51:44 +00:00
Bartek Iwańczuk
99dd8097c3
refactor: rewrite ext/node/http2 to op2 macro ( #20629 )
2023-09-23 10:25:36 -06:00
Matt Mastracci
06297d952d
feat(ext/web): use readableStreamDefaultReaderRead in resourceForReadableStream ( #20622 )
...
We can go one level down in abstraction and avoid using the public
`ReadableStream` APIs.
This patch ~5% perf boost on small ReadableStream:
```
Running 10s test @ http://localhost:8080/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 148.32us 108.95us 3.88ms 95.71%
Req/Sec 33.24k 2.68k 37.94k 73.76%
668188 requests in 10.10s, 77.74MB read
Requests/sec: 66162.91
Transfer/sec: 7.70MB
```
main:
```
Running 10s test @ http://localhost:8080/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 150.23us 67.61us 4.39ms 94.80%
Req/Sec 31.81k 1.55k 35.56k 83.17%
639078 requests in 10.10s, 74.36MB read
Requests/sec: 63273.72
Transfer/sec: 7.36MB
```
2023-09-23 14:55:28 +00:00
Bartek Iwańczuk
b1ca67ac01
fix(jupyter): await Jupyter.display evaluation ( #20646 )
2023-09-23 16:30:16 +02:00
Bartek Iwańczuk
1ad097c4bf
refactor: rewrite ops using i64/usize to op2 ( #20647 )
2023-09-23 14:04:47 +02:00
Divy Srivastava
75a724890d
fix(node): supported arguments to randomFillSync
( #20637 )
...
Fixes https://github.com/denoland/deno/issues/20634
2023-09-23 10:04:55 +02:00