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

10020 commits

Author SHA1 Message Date
Marcos Casagrande
65a94a6176
perf(ext/fetch): use new instead of createBranded (#20624)
This PR optimizes `fromInner*` methods of `Request` / `Header` /
`Response` used by `Deno.serve` and `fetch` by using `new` instead of
`ObjectCreate` from `createBranded`.

The "brand" is created by passing `webidl.brand` to the constructor
instead.


142449ecab/ext/webidl/00_webidl.js (L1001-L1005)

### Benchmark
```js
const createBranded = Symbol("create branded");
const brand = Symbol("brand");
class B {
  constructor(init) {
    if (init === createBranded) {
      this[brand] = brand;
    }
  }
}

Deno.bench("Object.create(protoype)", () => {
  Object.create(B.prototype);
});

Deno.bench("new Class", () => {
  new B(createBranded);
});
```

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

benchmark                    time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------- -----------------------------
Object.create(protoype)       8.74 ns/iter 114,363,610.3    (7.32 ns … 26.02 ns)   8.65 ns  13.39 ns  14.47 ns
new Class                     3.05 ns/iter 328,271,012.2      (2.78 ns … 9.1 ns)   3.06 ns   3.46 ns    3.5 ns
```
2023-09-21 20:06:42 -06:00
Bartek Iwańczuk
142449ecab
refactor: rewrite some ops to op2 macro (#20603) 2023-09-21 08:08:23 -06:00
Divy Srivastava
cf6f649829
fix(node): point process.version to Node 18.18.0 LTS (#20597)
Fixes https://github.com/denoland/deno/issues/20590
2023-09-21 06:44:37 +00:00
Nayeem Rahman
a4ac6a3f5f
refactor(lsp): store language sections in WorkspaceSettings (#20593)
When sending configuration requests to the client, reads `javascript`
and `typescript` sections in addition to `deno`.

The LSP's initialization options now accepts `javascript` and
`typescript` namespaces.
2023-09-21 06:46:39 +01:00
Matt Mastracci
0981aefbdc
fix(ext/web): Aggregate small packets for Resource implementation of ReadableStream (#20570)
Fixes: #20569 by introducing a custom replacement for the tokio mpsc
channel that is byte-size backpressure-aware.

Using the testcase in the linked bug, we see all the small writes
aggregated into a single packet and HTTP frame.

```
10:39 $ nc localhost 8000
GET / HTTP/1.1

HTTP/1.1 200 OK
content-type: text/plain
vary: Accept-Encoding
transfer-encoding: chunked
date: Tue, 19 Sep 2023 16:39:13 GMT

A
0
1
2
3
4
```

This patch:

```
Running 10s test @ http://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   157.47us  194.89us   9.53ms   98.97%
    Req/Sec    31.37k     1.56k   34.73k    85.15%
  630407 requests in 10.10s, 73.35MB read
Requests/sec:  62428.12
Transfer/sec:      7.26MB
```

main:

```
Running 10s test @ http://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   343.75us  200.48us  10.41ms   98.25%
    Req/Sec    14.64k   806.52    16.98k    84.65%
  294018 requests in 10.10s, 39.82MB read
Requests/sec:  29109.91
Transfer/sec:      3.94MB
```

---------

Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-09-20 11:23:58 -06:00
Bartek Iwańczuk
d77f3fba03
refactor: rewrite BC, cache exts to op2 (#20486)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-19 20:39:27 -06:00
Matt Mastracci
2a1781afcb
chore: bump Rust to 1.72.1 and cargo update (#20572)
> 1.72.1 resolves a few regressions introduced in 1.72.0:

> - [Partially revert codegen change, improving
codegen](https://github.com/rust-lang/rust/pull/115236)
> - [rustdoc: Fix self ty params in objects with
lifetimes](https://github.com/rust-lang/rust/pull/115276)
> - [Fix regression in compile
times](https://github.com/rust-lang/rust/pull/114948)
> - Resolve some ICEs in the compiler:
>   - [#115215](https://github.com/rust-lang/rust/pull/115215)
>   - [#115559](https://github.com/rust-lang/rust/pull/115559)
2023-09-20 01:48:36 +00:00
David Sherret
69b7166c20
chore: update manual instructions for doing a release (#20578) 2023-09-20 00:47:51 +00:00
David Sherret
81e55821d9
ci: install protoc on cargo_publish (#20577)
Closes https://github.com/denoland/deno/issues/20576
2023-09-19 20:24:20 -04:00
denobot
997aa604df
1.37.0 (#20574)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-09-19 20:29:17 +00:00
Matt Mastracci
612818d043
fix(cli): ensure that an exception in getOwnPropertyDescriptor('constructor') doesn't break Deno.inspect (#20568)
Fixes #20561
2023-09-19 18:24:19 +00:00
Nayeem Rahman
40122d7f2a
fix(lsp): force correct media type detection from tsc (#20562) 2023-09-19 16:37:27 +01:00
Nayeem Rahman
9004117790
fix(lsp): refresh npm completions on each character (#20565) 2023-09-19 12:01:06 +00:00
Luca Casonato
2772d302f5
perf: make deno test 10x faster (#20550) 2023-09-19 12:10:20 +02:00
Nayeem Rahman
b9b4ad31d9
refactor(lsp): dedup import map lookup for auto-imports (#20538) 2023-09-19 00:59:26 +01:00
Kyle Kelley
788bc8d021
fix(cli): Enhanced errors for Jupyter (#20530) 2023-09-18 22:07:33 +00:00
David Sherret
3de9af4d0b
fix(npm): properly handle legacy shasum of package (#20557)
Closes #20554
2023-09-18 16:40:41 -04:00
await-ovo
dc1da30927
fix(cli): for main-module that exists in package.json, use the version defined in package.json directly (#20328) 2023-09-18 20:02:58 +00:00
Nayeem Rahman
f5963b6a05
refactor(lsp): cleanup document preload (#20520) 2023-09-18 20:58:16 +01:00
Nayeem Rahman
86c04f43e0
fix(lsp): pass quote preference to tsc (#20547) 2023-09-18 20:48:32 +01:00
Nayeem Rahman
f7ba701304
fix(lsp): prefer local auto-import specifiers (#20539)
Give auto-import completion entries a sort-text suffix depending on if
the specifier parses as a URL. This will favour relative and bare
(likely import-mapped) specifiers.
2023-09-18 19:55:24 +01:00
Shreyas
d72f5d573a
fix: Deno.Command - improve error message when cwd is not a directory (#20460) 2023-09-18 17:48:54 +00:00
Nayeem Rahman
87ddd1f04d
fix(lsp): restore tsc's quick fix ordering (#20545) 2023-09-18 17:39:28 +01:00
Kyle Kelley
ee38bbbc8e
fix(jupyter-kernel): don't log errors from objects without a Symbol.for("Jupyter.display") (#20546)
Fast follow up to #20537.

Before:


![image](https://github.com/denoland/deno/assets/836375/8a12e83d-9008-419b-bd1f-24c0ac90afd3)

After:

<img width="235" alt="image"
src="https://github.com/denoland/deno/assets/836375/467bf381-278e-4577-a980-7b0ddb08d2af">

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-18 16:31:20 +00:00
Matt Mastracci
701931477c
fix(cli): fetch works in Jupyter (#20552)
An op2 needs to be overloaded by an op2, not an op1.
2023-09-18 15:39:39 +00:00
David Sherret
0709c051f8
feat(unstable): package manager (#20517)
Adds an experimental unstable built-in package manager to Deno, but it is
currently not usable because the registry infrastructure hasn't been
setup and it points to a non-existent url by default. The default
registry url can be configured via the `DENO_REGISTRY_URL` environment
variable.
2023-09-18 10:46:44 -04:00
Bartek Iwańczuk
4fcd9a0de8
fix(lsp): sort quickfix actions (#17221)
This commit changes ordering of quickfix actions, by sorting them in
following order:

- TSC fixes
- Deno fixes
- deno_lint fixes

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-09-17 19:05:19 +01:00
Kyle Kelley
81d6ea8e11
feat(jupyter-kernel): accept nested objects from display calls (#20537)
Closes #20535.

# Screenshots

## JSON
<img width="779" alt="image"
src="https://github.com/denoland/deno/assets/836375/668bb1a6-3f76-4b36-974e-cdc6c93f94c3">

## Vegalite

<img width="558" alt="image"
src="https://github.com/denoland/deno/assets/836375/a5e70908-6b87-42d8-85c3-1323ad52a00f">

# Implementation

Instead of going the route of recursively getting all the objects under
`application/.*json` keys, I went with `JSON.stringify`ing in denospace
then parsing it from rust. One of the key benefits of serializing and
deserializing is that non-JSON-able entries will get stripped
automatically. This also keeps the code pretty simple.

In the future we should _only_ do this for `application/.*json` keys.

cc @mmastrac
2023-09-17 10:38:52 -06:00
第二扩展
23bf05cff2
build: add an environment variable to skip cross build check (#20281) (#20533) 2023-09-17 16:06:51 +00:00
Marcos Casagrande
4960b6659c
perf(ext/streams): optimize async iterator (#20541)
This PR optimizes `ReadableStream` async iterator

### Benchmarks

```js
Deno.bench("Stream - iterator", async () => {
  const stream = new ReadableStream({
    start(controller) {
      controller.enqueue(new Uint8Array([97]));
      controller.enqueue(new Uint8Array([97]));
      controller.close();
    },
  });

  for await (const chunk of stream) {}
});
```

**main**

`2 chunks`
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.4 (x86_64-unknown-linux-gnu)

benchmark              time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------- -----------------------------
Stream - iterator      12.45 µs/iter      80,295.5   (10.5 µs … 281.12 µs)  12.13 µs  26.71 µs  33.63 µs
```
`20 chunks`

```
benchmark              time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------- -----------------------------
Stream - iterator      32.99 µs/iter      30,312.2    (28.13 µs … 1.21 ms)   31.8 µs  81.82 µs 179.93 µs
```
---

**this PR**

`2 chunks`
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.4 (x86_64-unknown-linux-gnu)

benchmark              time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------- -----------------------------
Stream - iterator       9.37 µs/iter     106,700.8   (8.35 µs … 730.71 µs)   9.15 µs  13.12 µs  18.17 µs
```
`20 chunks`
```
benchmark              time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------- -----------------------------
Stream - iterator      16.59 µs/iter      60,270.0    (12.08 µs … 1.37 ms)  15.06 µs  83.03 µs 123.52 µs
```
2023-09-17 15:54:40 +00:00
Nayeem Rahman
fa18878f54
fix(lsp): include JSON modules in local import completions (#20536) 2023-09-17 07:50:30 +01:00
Kyle Kelley
3b2e553b05
set evalue to a one space string for truthiness on old jupyter (#20531)
"Fixes" the exception display issue of #20524 on older versions of
Jupyter that required `evalue` to be truthy. For now, until we can do
proper processing of the `ExceptionDetails` this will make Jupyter
Notebook 6.5.1 and below happy.

This is the alternative "just work now" PR to #20530
2023-09-17 02:02:21 +00:00
Juan Gonzalez
e995ba66cd
docs(contributing): Fix README link to contributing docs (#20526)
Fixing a broken link to the contributing docs
2023-09-16 21:54:28 +00:00
Marcos Casagrande
16b7c9cd8d
perf(ext/http): optimize set_response for small responses (#20527)
This PR introduces an optimization to `set_response` to reduce the
overhead for responses with a payload size less than 64 bytes.
Performance gains are more noticeable when `is_request_compressible`
enters the slow path, ie: `-H 'Accept-Encoding: unknown'`

### Benchmarks
```js
Deno.serve({ port: 3000 }, () => new Response("hello"));
```
```
wrk -d 10s --latency -H 'Accept-Encoding: slow' http://127.0.0.1:3000
```
---
**main**
```
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    44.72us   28.12us   3.10ms   97.95%
    Req/Sec   112.73k     8.25k  123.66k    91.09%
  2264092 requests in 10.10s, 308.77MB read
Requests/sec: 224187.08
Transfer/sec:     30.57MB
```
**this PR**
```
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    42.91us   20.57us   2.04ms   97.36%
    Req/Sec   116.61k     7.95k  204.81k    88.56%
  2330970 requests in 10.10s, 317.89MB read
Requests/sec: 230806.32
Transfer/sec:     31.48MB
```
2023-09-16 15:15:15 -06:00
Nayeem Rahman
d13e6e6db8
feat(lsp): include source in auto import completion label (#20523) 2023-09-16 15:51:35 +01:00
Luca Casonato
430b63c2c4
perf: improve async op santizer speed and accuracy (#20501)
This commit improves async op sanitizer speed by only delaying metrics
collection if there are pending ops. This
results in a speedup of around 30% for small CPU bound unit tests.

It performs this check and possible delay on every collection now,
fixing an issue with parent test leaks into steps.
2023-09-16 07:48:31 +02:00
Bartek Iwańczuk
bf07604113
feat: Add "deno jupyter" subcommand (#20337)
This commit adds "deno jupyter" subcommand which
provides a Deno kernel for Jupyter notebooks.

The implementation is mostly based on Deno's REPL and
reuses large parts of it (though there's some clean up that
needs to happen in follow up PRs). Not all functionality of
Jupyter kernel is implemented and some message type
are still not implemented (eg. "inspect_request") but
the kernel is fully working and provides all the capatibilities
that the Deno REPL has; including TypeScript transpilation
and npm packages support.

Closes https://github.com/denoland/deno/issues/13016

---------

Co-authored-by: Adam Powers <apowers@ato.ms>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-16 02:42:09 +02:00
Bartek Iwańczuk
5a1505db67
feat(ext/node): http2.connect() API (#19671)
This commit improves compatibility of "node:http2" module by polyfilling
"connect" method and "ClientHttp2Session" class. Basic operations like
streaming, header and trailer handling are working correctly. 
Refing/unrefing is still a TODO and "npm:grpc-js/grpc" is not yet working
correctly.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-15 21:51:25 +02:00
Nayeem Rahman
11f0ccf805
fix(test): share fail fast tracker between threads (#20515) 2023-09-15 15:46:48 +00:00
Matt Mastracci
d226970c0e
chore(ext/http): fix a rejection test (#20514)
Use `assertRejects` to actually catch errors.
2023-09-15 08:53:38 -06:00
Matt Mastracci
71af3c375c
fix(ext/http): ensure aborted bodies throw (#20503)
Fixes #20502 -- ensure that Hyper errors make it through to JS.
2023-09-15 08:08:21 -06:00
Luca Casonato
06ece5645c
fix: init v8 platform once on main thread (#20495)
This is a mitigation for segfaults happening in V8 on CPU with MPK
(memory protected keys).

After much trail and error we found that unless V8 platform is
initialized on main thread the segfaults start appears once JIT 
kicks in. "deno test" and "deno bench" were affected by
this problem.

Fixes https://github.com/denoland/deno/issues/19926
Fixes https://github.com/denoland/deno/issues/20243
Fixes https://github.com/denoland/deno/issues/20450

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-15 00:17:01 +02:00
Bartek Iwańczuk
5e7435fb80
refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
Matt Mastracci
dc505e905e
chore(cli): update chrono to remove broken time dep (#20508)
Fixes the last dependabot security warning
2023-09-14 13:17:38 -06:00
Matt Mastracci
5ba89666af
chore: update deno_core + cargo update (#20507) 2023-09-14 19:00:25 +00:00
David Sherret
6dc8682b9a
feat: explicit resource management in TypeScript (#20506)
This adds support for `using` and `await using` declarations in
TypeScript only. We need to wait for v8 to support it for this to work
in JS.
2023-09-14 18:08:59 +00:00
David Sherret
e66d3c2c2e
refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504)
https://github.com/denoland/deno/pull/20488 enables us to remove this
functionality. This is better because our test suite is now not testing
a separate code path.
2023-09-14 17:51:28 +00:00
David Sherret
54890ee98b
chore(tests): ability to pattern match unordered lines (#20488)
This adds the ability to pattern match unordered lines. For example, the
downloading messages may appear in any order

```
[UNORDERED_START]
Download https://localhost:4546/a.ts
Download https://localhost:4546/b.ts
[UNORDERED_END]
Hello!
```

Additionally, I've made the pattern matching slightly more strict and the output better.
2023-09-14 16:21:57 +00:00
Luca Casonato
851f795001
fix: output traces for op sanitizer in more cases (#20494)
This adds traces for the "started outside test, closed inside test"
case.
2023-09-14 16:38:15 +02:00
Bartek Iwańczuk
bbb348aa33
refactor: rewrite ext/node to op2 (#20489) 2023-09-14 08:29:44 +02:00