Matt Mastracci
bfd230fd78
chore: update inner #\![allow] to #[allow] ( #20463 )
...
Functions should generally be annotated with `#[allow]` blocks rather
than using inner `#![allow]` annotations.
2023-09-11 17:12:33 -06:00
Aapo Alasuutari
9d6584c16f
perf(ext/node): Optimise Buffer string operations ( #20158 )
...
Extracted from https://github.com/denoland/deno/pull/17815
Optimise Buffer's string operations, most significantly when dealing
with ASCII and UTF-16. Base64 and HEX encodings are affected to much
lesser degrees.
## Performance
### String length 15
With very small strings we're at break-even or sometimes even lose a tad
bit of performance from creating a `DataView` that ends up not paying
for itself.
**This PR:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 1.15 µs/iter 871,388.6 (728.78 ns … 1.56 µs) 1.23 µs 1.56 µs 1.56 µs
Buffer.from base64 string 1.63 µs/iter 612,790.9 (1.31 µs … 1.96 µs) 1.77 µs 1.96 µs 1.96 µs
Buffer.from utf16 string 1.41 µs/iter 707,396.3 (915.24 ns … 1.93 µs) 1.61 µs 1.93 µs 1.93 µs
Buffer.from hex string 1.87 µs/iter 535,357.9 (1.56 µs … 2.19 µs) 2 µs 2.19 µs 2.19 µs
Buffer.toString ascii string 154.58 ns/iter 6,469,162.8 (149.69 ns … 198 ns) 154.51 ns 182.89 ns 191.91 ns
Buffer.toString base64 string 161.65 ns/iter 6,186,189.6 (150.91 ns … 181.15 ns) 165.18 ns 171.87 ns 174.94 ns
Buffer.toString utf16 string 292.74 ns/iter 3,415,959.8 (285.43 ns … 312.47 ns) 295.25 ns 310.47 ns 312.47 ns
Buffer.toString hex string 89.61 ns/iter 11,159,315.6 (81.09 ns … 123.77 ns) 91.09 ns 113.62 ns 119.28 ns
```
**Main:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 1.26 µs/iter 794,875.8 (1.07 µs … 1.46 µs) 1.31 µs 1.46 µs 1.46 µs
Buffer.from base64 string 1.65 µs/iter 607,853.3 (1.38 µs … 2.01 µs) 1.69 µs 2.01 µs 2.01 µs
Buffer.from utf16 string 1.34 µs/iter 744,894.6 (1.09 µs … 1.55 µs) 1.45 µs 1.55 µs 1.55 µs
Buffer.from hex string 2.01 µs/iter 496,345.8 (1.54 µs … 2.6 µs) 2.26 µs 2.6 µs 2.6 µs
Buffer.toString ascii string 150.16 ns/iter 6,659,630.5 (144.99 ns … 166.68 ns) 152.4 ns 157.26 ns 159.14 ns
Buffer.toString base64 string 164.73 ns/iter 6,070,692.0 (158.77 ns … 185.63 ns) 168.48 ns 175.74 ns 176.68 ns
Buffer.toString utf16 string 150.61 ns/iter 6,639,864.0 (148.2 ns … 168.29 ns) 150.93 ns 157.21 ns 168.15 ns
Buffer.toString hex string 94.21 ns/iter 10,614,972.9 (86.21 ns … 98.75 ns) 95.43 ns 97.99 ns 98.21 ns
```
### String length 1500
With moderate lengths we already see great upsides for `Buffer.from()`
with ASCII and UTF-16.
**This PR:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 5.79 µs/iter 172,562.6 (4.72 µs … 4.71 ms) 5.04 µs 10.3 µs 11.67 µs
Buffer.from base64 string 5.08 µs/iter 196,678.9 (4.97 µs … 5.76 µs) 5.08 µs 5.76 µs 5.76 µs
Buffer.from utf16 string 9.68 µs/iter 103,316.5 (7.14 µs … 3.44 ms) 10.32 µs 13.42 µs 15.21 µs
Buffer.from hex string 53.7 µs/iter 18,620.2 (49.37 µs … 2.2 ms) 54.74 µs 72.2 µs 81.07 µs
Buffer.toString ascii string 6.63 µs/iter 150,761.3 (5.59 µs … 1.11 ms) 6.08 µs 15.68 µs 24.77 µs
Buffer.toString base64 string 460.57 ns/iter 2,171,224.4 (448.33 ns … 511.73 ns) 465.05 ns 495.54 ns 511.73 ns
Buffer.toString utf16 string 6.52 µs/iter 153,287.0 (6.47 µs … 6.66 µs) 6.53 µs 6.66 µs 6.66 µs
Buffer.toString hex string 3.68 µs/iter 271,965.4 (3.64 µs … 3.82 µs) 3.68 µs 3.82 µs 3.82 µs
```
**Main:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 11.46 µs/iter 87,298.1 (8.53 µs … 834.1 µs) 9.61 µs 83.31 µs 87.3 µs
Buffer.from base64 string 5.4 µs/iter 185,027.8 (5.07 µs … 7.49 µs) 5.44 µs 7.49 µs 7.49 µs
Buffer.from utf16 string 20.3 µs/iter 49,270.8 (13.55 µs … 649.11 µs) 18.8 µs 113.93 µs 125.17 µs
Buffer.from hex string 52.03 µs/iter 19,218.9 (48.74 µs … 2.59 ms) 52.84 µs 67.05 µs 73.56 µs
Buffer.toString ascii string 6.46 µs/iter 154,822.5 (6.32 µs … 6.69 µs) 6.52 µs 6.69 µs 6.69 µs
Buffer.toString base64 string 440.19 ns/iter 2,271,764.6 (427 ns … 490.77 ns) 444.74 ns 484.64 ns 490.77 ns
Buffer.toString utf16 string 6.89 µs/iter 145,106.7 (6.81 µs … 7.24 µs) 6.91 µs 7.24 µs 7.24 µs
Buffer.toString hex string 3.66 µs/iter 273,456.5 (3.6 µs … 4.02 µs) 3.64 µs 4.02 µs 4.02 µs
```
### String length 2^20
With massive lengths we the difference in ASCII and UTF-16 parsing
performance is enormous.
**This PR:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 4.1 ms/iter 243.7 (2.64 ms … 6.74 ms) 4.43 ms 6.26 ms 6.74 ms
Buffer.from base64 string 3.74 ms/iter 267.6 (2.91 ms … 4.92 ms) 3.96 ms 4.31 ms 4.92 ms
Buffer.from utf16 string 7.72 ms/iter 129.5 (5.91 ms … 11.03 ms) 7.97 ms 11.03 ms 11.03 ms
Buffer.from hex string 35.72 ms/iter 28.0 (34.71 ms … 38.42 ms) 35.93 ms 38.42 ms 38.42 ms
Buffer.toString ascii string 78.92 ms/iter 12.7 (42.72 ms … 94.13 ms) 91.64 ms 94.13 ms 94.13 ms
Buffer.toString base64 string 833.62 µs/iter 1,199.6 (638.05 µs … 5.97 ms) 826.86 µs 2.45 ms 2.48 ms
Buffer.toString utf16 string 79.35 ms/iter 12.6 (69.72 ms … 88.9 ms) 86.66 ms 88.9 ms 88.9 ms
Buffer.toString hex string 31.04 ms/iter 32.2 (4.3 ms … 46.9 ms) 37.21 ms 46.9 ms 46.9 ms
```
**Main:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 18.66 ms/iter 53.6 (15.61 ms … 23.26 ms) 20.62 ms 23.26 ms 23.26 ms
Buffer.from base64 string 4.7 ms/iter 212.9 (2.94 ms … 9.07 ms) 4.65 ms 9.06 ms 9.07 ms
Buffer.from utf16 string 33.49 ms/iter 29.9 (31.24 ms … 35.67 ms) 34.08 ms 35.67 ms 35.67 ms
Buffer.from hex string 39.38 ms/iter 25.4 (38.66 ms … 42.36 ms) 39.58 ms 42.36 ms 42.36 ms
Buffer.toString ascii string 77.68 ms/iter 12.9 (67.46 ms … 95.68 ms) 84.71 ms 95.68 ms 95.68 ms
Buffer.toString base64 string 825.53 µs/iter 1,211.3 (655.38 µs … 6.69 ms) 816.62 µs 3.07 ms 3.13 ms
Buffer.toString utf16 string 76.54 ms/iter 13.1 (66.9 ms … 85.26 ms) 83.63 ms 85.26 ms 85.26 ms
Buffer.toString hex string 38.56 ms/iter 25.9 (33.83 ms … 46.56 ms) 45.33 ms 46.56 ms 46.56 ms
```
2023-09-07 14:41:16 -06:00
David Sherret
3fc19dab47
feat: support import attributes ( #20342 )
2023-09-07 09:09:16 -04:00
Bartek Iwańczuk
9e243d22f4
Revert "refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' ( #20303 ) ( #20370 )
...
This reverts commit
83426be6ee
.
Includes a regression test.
2023-09-04 17:05:06 -04:00
Bartek Iwańczuk
83426be6ee
refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' ( #20303 )
...
Rewrites 3 ops that used "op(deferred)" to use "op2(async(lazy))"
instead.
This will allow us to remove codepath for handling "deferred" ops in
"deno_core".
2023-09-02 08:48:21 +02:00
Bartek Iwańczuk
2b191c6e9d
chore: forward v1.36.4 to main ( #20352 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-09-01 18:08:58 +00:00
林炳权
2080669943
chore: update to Rust 1.72 ( #20258 )
...
<!--
Before submitting a PR, please read https://deno.com/manual/contributing
1. Give the PR a descriptive title.
Examples of good title:
- fix(std/http): Fix race condition in server
- docs(console): Update docstrings
- feat(doc): Handle nested reexports
Examples of bad title:
- fix #7123
- update docs
- fix bugs
2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
As the title.
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-26 22:04:12 -06:00
denobot
3a2d284c96
chore: forward v1.36.3 release commit to main ( #20270 )
...
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-24 17:53:01 +00:00
Matt Mastracci
9b01307704
fix(ext/web): better handling of errors in resourceForReadableStream ( #20238 )
...
Improves error handling when the Resource is closed in various phases of
the ReadableStream. Ensure that we send a consistent `cancel` reason.
2023-08-22 16:16:34 -06:00
Bartek Iwańczuk
32bbba3db2
perf(ext/event): always set timeStamp to 0 ( #20191 )
...
```js
Deno.bench(function eventNew() {
new Event("foo");
});
```
<b>main</b>
```
./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)
file:///Users/ib/dev/deno/event_bench.js
benchmark time (avg) iter/s (min … max) p75 p99 p995
--------------------------------------------------------------- -----------------------------
eventNew 36.43 ns/iter 27,451,874.9 (35.15 ns … 46.98 ns) 37.68 ns 40.7 ns 41.69 ns
```
<b>this PR</b>
```
./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)
file:///Users/ib/dev/deno/event_bench.js
benchmark time (avg) iter/s (min … max) p75 p99 p995
--------------------------------------------------------------- -----------------------------
eventNew 13.71 ns/iter 72,958,970.0 (12.85 ns … 31.79 ns) 15.11 ns 16.49 ns 17.5 ns
```
Towards #20167
2023-08-20 10:02:47 +00:00
Marcos Casagrande
7847de0974
perf(ext/event): optimize addEventListener options converter ( #20203 )
...
This PR optimizes `addEventListener` by replacing
`webidl.createDictionaryConverter("AddEventListenerOptions", ...)` with
a custom options parsing function to avoid the overhead of `webidl`
methods
**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
---------------------------------------------------------------------------------------------------- -----------------------------
addEventListener options converter (undefined) 4.87 ns/iter 205,248,660.8 (4.7 ns … 13.18 ns) 4.91 ns 5.4 ns 5.6 ns
addEventListener options converter (signal) 13.02 ns/iter 76,782,031.2 (11.74 ns … 18.84 ns) 13.08 ns 16.22 ns 16.57 ns
```
**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
---------------------------------------------------------------------------------------------------- -----------------------------
addEventListener options converter (undefined) 108.36 ns/iter 9,228,688.6 (103.5 ns … 129.88 ns) 109.69 ns 115.61 ns 125.28 ns
addEventListener options converter (signal) 134.03 ns/iter 7,460,878.1 (129.14 ns … 144.54 ns) 135.68 ns 141.13 ns 144.1 ns
```
```js
const tg = new EventTarget();
const signal = new AbortController().signal;
Deno.bench("addEventListener options converter (undefined)", () => {
tg.addEventListener("foo", null); // null callback to only bench options converter
});
Deno.bench("addEventListener options converter (signal)", () => {
tg.addEventListener("foo", null, { signal });
});
```
Towards https://github.com/denoland/deno/issues/20167
2023-08-20 11:30:57 +02:00
Marcos Casagrande
e1aa514179
perf(ext/event): replace ReflectHas with object lookup ( #20190 )
...
This PR optimizes event dispatch by replacing `ReflectHas` with object
lookup. I also made `isSlottable` return `false` since AFAIK there
aren't any slottables nodes in Deno
**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
--------------------------------------------------------------------- -----------------------------
event dispatch 80.46 ns/iter 12,428,739.4 (73.84 ns … 120.07 ns) 81.82 ns 86.34 ns 91.18 ns
```
**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
--------------------------------------------------------------------- -----------------------------
event dispatch 102.66 ns/iter 9,741,319.6 (96.66 ns … 132.88 ns) 104.18 ns 114.58 ns 118.45 ns
```
```js
const tg = new EventTarget();
const ev = new Event("foo");
const listener = () => {};
tg.addEventListener("foo", listener);
Deno.bench("event dispatch ", () => {
tg.dispatchEvent(ev);
});
```
towards https://github.com/denoland/deno/issues/20167
2023-08-18 14:44:57 +02:00
Matt Mastracci
23ff0e722e
feat(ext/web): resourceForReadableStream ( #20180 )
...
Extracted from fast streams work.
This is a resource wrapper for `ReadableStream`, allowing us to treat
all `ReadableStream` instances as resources, and remove special paths in
both `fetch` and `serve`.
Performance with a ReadableStream response yields ~18% improvement:
```
return new Response(new ReadableStream({
start(controller) {
controller.enqueue(new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]));
controller.close();
}
})
```
This patch:
```
12:36 $ third_party/prebuilt/mac/wrk http://localhost:8080
Running 10s test @ http://localhost:8080
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 99.96us 100.03us 6.65ms 98.84%
Req/Sec 47.73k 2.43k 51.02k 89.11%
959308 requests in 10.10s, 117.10MB read
Requests/sec: 94978.71
Transfer/sec: 11.59MB
```
main:
```
Running 10s test @ http://localhost:8080
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 163.03us 685.51us 19.73ms 99.27%
Req/Sec 39.50k 3.98k 66.11k 95.52%
789582 requests in 10.10s, 82.83MB read
Requests/sec: 78182.65
Transfer/sec: 8.20MB
```
2023-08-17 07:52:37 -06:00
Marcos Casagrande
ec63b36994
perf(ext/event): optimize Event constructor ( #20181 )
...
This PR optimizes `Event` constructor
- ~Added a fast path for empty `eventInitDict`~ Removed `EventInit`
dictionary converter
- Don't make `isTrusted` a
[LegacyUnforgeable](https://webidl.spec.whatwg.org/#LegacyUnforgeable )
property. Doing so makes it non-spec compliant but calling
`Object/Reflect.defineProperty` on the constructor is a big bottleneck.
Node did the same a few months ago
https://github.com/nodejs/node/pull/46974 . In my opinion, the
performance gains are worth deviating from the spec for a
browser-related property.
**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
------------------------------------------------------------------------------- -----------------------------
event constructor no init 36.69 ns/iter 27,257,504.6 (33.36 ns … 42.45 ns) 37.71 ns 39.61 ns 40.07 ns
event constructor 36.7 ns/iter 27,246,776.6 (33.35 ns … 56.03 ns) 37.73 ns 40.14 ns 41.74 ns
```
**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
------------------------------------------------------------------------------- -----------------------------
event constructor no init 380.48 ns/iter 2,628,275.8 (366.66 ns … 399.39 ns) 384.58 ns 398.27 ns 399.39 ns
event constructor 480.33 ns/iter 2,081,882.6 (466.67 ns … 503.47 ns) 484.27 ns 501.28 ns 503.47 ns
```
```js
Deno.bench("event constructor no init", () => {
const event = new Event("foo");
});
Deno.bench("event constructor", () => {
const event = new Event("foo", { bubbles: true, cancelable: false });
});
```
towards https://github.com/denoland/deno/issues/20167
2023-08-17 10:35:18 +02:00
Marcos Casagrande
0fc31d9d65
fix(ext/fetch): clone second branch chunks in Body.clone() ( #20057 )
...
This PR makes `Body.clone()` spec compliant:
https://fetch.spec.whatwg.org/#concept-body-clone
> 1, Let « out1, out2 » be the result of
[teeing](https://streams.spec.whatwg.org/#readablestream-tee ) body’s
[stream](https://fetch.spec.whatwg.org/#concept-body-stream ).
> ...
> To tee a
[ReadableStream](https://streams.spec.whatwg.org/#readablestream )
stream, return ?
[ReadableStreamTee](https://streams.spec.whatwg.org/#readable-stream-tee )(stream,
true).
---
Closes #10994
2023-08-15 09:21:02 +02:00
Divy Srivastava
94d664535b
chore: forward v1.36.1 to main ( #20119 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-08-10 16:44:41 +03:00
Bartek Iwańczuk
8f854782b1
fix(ext/timers): some timers are not resolved ( #20055 )
...
Fixes https://github.com/denoland/deno/issues/19866
2023-08-10 04:01:35 +00:00
Marcos Casagrande
557b11b765
fix(ext/abort): trigger AbortSignal events in correct order ( #20095 )
...
This PR ensures that the original signal event is fired before any
dependent signal events.
---
The enabled tests fail on `main`:
```
assert_array_equals: Abort events fired in correct order expected property 0 to be
"original-aborted" but got "clone-aborted" (expected array ["original-aborted", "clone-aborted"]
got ["clone-aborted", "original-aborted"])
```
2023-08-08 12:05:42 +02:00
Marcos Casagrande
5311f69bbb
fix(ext/file): resolve unresolved Promise in Blob.stream ( #20039 )
...
This PR fixes some crashing WPT tests due to an unresolved promise.
---
This could be a [stream spec](https://streams.spec.whatwg.org ) bug
When `controller.close` is called on a byob stream, there's no cleanup
of pending `readIntoRequests`. The only cleanup of pending
`readIntoRequests` happen when `.byobRequest.respond(0)` is called, it
happens
here:6ba245fe25/ext/web/06_streams.js (L2026)
which ends up calling `readIntoRequest.closeSteps(chunk);` in
6ba245fe25/ext/web/06_streams.js (L2070)
To reproduce:
```js
async function byobRead() {
const input = [new Uint8Array([8, 241, 48, 123, 151])];
const stream = new ReadableStream({
type: "bytes",
async pull(controller) {
if(input.length === 0) {
controller.close();
// controller.byobRequest.respond(0); // uncomment for fix
return
}
controller.enqueue(input.shift())
},
});
const reader = stream.getReader({ mode: 'byob' });
const r1 = await reader.read(new Uint8Array(64));
console.log(r1);
const r2 = await reader.read(new Uint8Array(64));
console.log(r2);
}
await byobRead();
```
Running the script triggers:
```
error: Top-level await promise never resolved
```
2023-08-04 13:57:54 +02:00
denobot
6ba245fe25
1.36.0 ( #20036 )
...
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-08-03 18:26:25 +02:00
Ricardo Iván Vieitez Parra
98403691d1
fix: call setIsTrusted for generated events (MessageEvent) ( #19919 )
...
This addresses issue #19918 .
## Issue description
Event messages have the wrong isTrusted value when they are not
triggered by user interaction, which differs from the browser. In
particular, all MessageEvents created by Deno have isTrusted set to
false, even though it should be true.
This is my first ever contribution to Deno, so I might be missing
something.
2023-07-31 23:22:07 +02:00
Nayeem Rahman
d5efdeeff1
refactor: update core extension api usage ( #19952 )
2023-07-31 18:19:15 +00:00
Marcos Casagrande
ee7f36afdb
fix(ext/compression): throw TypeError on corrupt input ( #19979 )
...
`TypeError` should be thrown when decompressing a corrupt input
2023-07-30 09:15:29 -04:00
denobot
89ba3f820c
1.35.3 ( #19947 )
...
Bumped versions for 1.35.3
Co-authored-by: mmastrac <mmastrac@users.noreply.github.com>
2023-07-26 10:18:02 -04:00
denobot
0c3bbf7acd
chore: forward v1.35.2 release commit to main ( #19887 )
...
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-20 05:11:50 +02:00
Matt Mastracci
8465bd0037
chore: update to Rust 1.71 ( #19822 )
2023-07-13 15:16:24 -06:00
David Sherret
2f4b73410a
chore: forward 1.35.1 back to main ( #19814 )
2023-07-12 21:36:42 -04:00
Divy Srivastava
75d2c045f7
perf(ext/websocket): optimize server websocket js ( #19719 )
...
Split from https://github.com/denoland/deno/pull/19686
- timestamp set to 0 for server websocket events.
- take fast call path with op_ws_send_binary.
2023-07-07 09:09:25 +05:30
denobot
1ac5fddf54
1.35.0 ( #19717 )
...
Bumped versions for 1.35.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-05 01:58:01 +02:00
ud2
d632cce129
fix(dts): make globals available on globalThis ( #19438 )
...
This PR changes Web IDL interfaces to be declared with `var` instead of
`class`, so that accessing them via `globalThis` does not raise type
errors.
Closes #13390 .
2023-07-03 14:36:55 -04:00
Leo Kettmeir
805497a9a5
feat: ReadableStream.from ( #19446 )
...
Closes #19417
2023-07-02 19:30:05 +02:00
Nayeem Rahman
b9c0e7cd55
Reland "fix(cli): don't store blob and data urls in the module cache" ( #18581 )
...
Relands #18261 now that
https://github.com/lucacasonato/esbuild_deno_loader/pull/54 is landed
and used by fresh.
Fixes #18260 .
2023-07-02 00:52:30 +02:00
Martin Fischer
801b9ec62d
chore: fix typos ( #19572 )
2023-06-26 09:10:27 -04:00
Bartek Iwańczuk
ad3c494b46
Revert "Reland "refactor(core): cleanup feature flags for js source i… ( #19611 )
...
…nclusion" (#19519 )"
This reverts commit 28a4f3d0f5
.
This change causes failures when used outside Deno repo:
```
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new .
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.
Platform: linux x86_64
Version: 1.34.3+b37b286
Args: ["/opt/hostedtoolcache/deno/0.0.0-b37b286f7fa68d5656f7c180f6127bdc38cf2cf5/x64/deno", "test", "--doc", "--unstable", "--allow-all", "--coverage=./cov"]
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to read "/home/runner/work/deno/deno/core/00_primordials.js"
Caused by:
No such file or directory (os error 2)', core/runtime/jsruntime.rs:699:8
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
2023-06-26 13:54:10 +02:00
Nayeem Rahman
28a4f3d0f5
Reland "refactor(core): cleanup feature flags for js source inclusion" ( #19519 )
...
Relands #19463 . This time the `ExtensionFileSourceCode` enum is
preserved, so this effectively just splits feature
`include_js_for_snapshotting` into `exclude_js_sources` and
`runtime_js_sources`, adds a `force_include_js_sources` option on
`extension!()`, and unifies `ext::Init_ops_and_esm()` and
`ext::init_ops()` into `ext::init()`.
2023-06-25 09:35:31 +02:00
Martin Fischer
8d6dbda90e
chore(ext/web): align with whatwg/dom typo fix ( #19584 )
...
The WHATWG DOM specification has corrected the spelling of "slotable" to
"slottable".[1] This commit aligns our implementation accordingly.
[1]: https://github.com/whatwg/dom/pull/845
2023-06-24 12:20:14 +02:00
Bartek Iwańczuk
dda0f1c343
refactor(serde_v8): split ZeroCopyBuf into JsBuffer and ToJsBuffer ( #19566 )
...
`ZeroCopyBuf` was convenient to use, but sometimes it did hide details
that some copies were necessary in certain cases. Also it made it way to easy
for the caller to pass around and convert into different values. This commit
splits `ZeroCopyBuf` into `JsBuffer` (an array buffer coming from V8) and
`ToJsBuffer` (a Rust buffer that will be converted into a V8 array buffer).
As a result some magical conversions were removed (they were never used)
limiting the API surface and preparing for changes in #19534 .
2023-06-22 23:37:56 +02:00
denobot
239dc5e681
chore: forward v1.34.3 release commit to main ( #19526 )
...
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-16 01:55:31 +02:00
Bartek Iwańczuk
348287825c
perf(web): optimize timer resolution ( #19493 )
...
Closes https://github.com/denoland/deno/issues/19348
This changes benchmark from the issue from:
```
deno run -A https://raw.githubusercontent.com/nats-io/nats.deno/deno-transport-changes/examples/bench.js --subject a --payload 3500 --pub --count 650000
pub 7,636 msgs/sec - [85.13 secs] ~ 25.49 MB/sec 85127.8765/85127.8765
```
to:
```
> ./target/release/deno run -A https://raw.githubusercontent.com/nats-io/nats.deno/deno-transport-changes/examples/bench.js --subject a --payload 3500 --pub --count 650000
pub 176,840 msgs/sec - [3.68 secs] ~ 590.27 MB/sec 3675.646833/3675.646833
> ./target/release/deno run -A https://raw.githubusercontent.com/nats-io/nats.deno/deno-transport-changes/examples/bench.js --subject a --payload 3500 --pub --count 650000
pub 174,589 msgs/sec - [3.72 secs] ~ 582.76 MB/sec 3723.01925/3723.01925
```
2023-06-14 17:04:49 +02:00
Bartek Iwańczuk
5ef225853c
perf: don't run microtask checkpoint if macrotask callback did no work ( #19492 )
...
Most of the time there's no firing timers, nor pending promise
rejections, so it's wasteful to run microtask checkpoint
additionally twice on each tick of the event loop.
Closes https://github.com/denoland/deno/issues/18871
Ref https://github.com/denoland/deno/issues/19451
2023-06-14 16:21:06 +02:00
Bartek Iwańczuk
60bf79c184
Revert "refactor(core): cleanup feature flags for js source inclusion… ( #19490 )
...
… (#19463 )"
This reverts commit ceb03cfb03
.
This is being reverted because it causes 3.5Mb increase in the binary
size,
due to runtime JS code being included in the binary, even though it's
already snapshotted.
CC @nayeemrmn
2023-06-13 22:36:16 +00:00
Nayeem Rahman
ceb03cfb03
refactor(core): cleanup feature flags for js source inclusion ( #19463 )
...
Remove `ExtensionFileSourceCode::LoadedFromFsDuringSnapshot` and feature
`include_js_for_snapshotting` since they leak paths that are only
applicable in this repo to embedders. Replace with feature
`exclude_js_sources`. Additionally the feature
`force_include_js_sources` allows negating it, if both features are set.
We need both of these because features are additive and there must be a
way of force including sources for snapshot creation while still having
the `exclude_js_sources` feature. `force_include_js_sources` is only set
for build deps, so sources are still excluded from the final binary.
You can also specify `force_include_js_sources` on any extension to
override the above features for that extension. Towards #19398 .
But there was still the snapshot-from-snapshot situation where code
could be executed twice, I addressed that by making `mod_evaluate()` and
scripts like `core/01_core.js` behave idempotently. This allowed
unifying `ext::init_ops()` and `ext::init_ops_and_esm()` into
`ext::init()`.
2023-06-13 09:45:06 -06:00
denobot
1b26f3c726
chore: forward v1.34.2 release commit to main ( #19434 )
...
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-09 02:17:03 +00:00
Matt Mastracci
0bbdbace02
refactor(core): ensureFastOps is an op-generating proxy ( #19377 )
...
Startup benchmark shows no changes (within 1ms, identical system/user
times).
2023-06-06 11:01:28 +02:00
David Sherret
5c55f2b4fb
chore: upgrade to Rust 1.70.0 ( #19345 )
...
Co-authored-by: linbingquan <695601626@qq.com>
2023-06-06 00:35:39 +00:00
Kenta Moriuchi
d54ef02dfe
chore: update deno_lint to 0.46.0 ( #19372 )
2023-06-05 15:57:01 -04:00
Bartek Iwańczuk
21c2c01ebe
perf: optimize RegExp usage in JS ( #19364 )
...
Towards https://github.com/denoland/deno/issues/19330
Shows about 1% improvement in the HTTP benchmark.
2023-06-05 10:52:40 +02:00
Koen
adf41edda1
fix(ext/web): Copy EventTarget list before dispatch ( #19360 )
...
Related issue: https://github.com/denoland/deno/issues/19358 .
This is a regression that seems to have been introduced in
https://github.com/denoland/deno/pull/18905 . It looks to have been a
performance optimization.
The issue is probably easiest described with some code:
```ts
const target = new EventTarget();
const event = new Event("foo");
target.addEventListener("foo", () => {
console.log('base');
target.addEventListener("foo", () => {
console.log('nested');
});
});
target.dispatchEvent(event);
```
Essentially, the second event listener is being attached while the `foo`
event is still being dispatched. It should then not fire that second
event listener, but Deno currently does.
2023-06-04 18:03:44 -06:00
Leo Kettmeir
6e0bf093c5
refactor: further work on node http client ( #19327 )
...
Closes https://github.com/denoland/deno/issues/18300
2023-05-31 20:06:21 +02:00
Bartek Iwańczuk
acc6cdc0b1
chore: forward v1.34.1 to main ( #19312 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-05-29 20:26:03 -06:00