summaryrefslogtreecommitdiff
path: root/ext/web/timers.rs
AgeCommit message (Collapse)Author
2024-11-08fix: performance.timeOrigin (#26787)snek
`performance.timeOrigin` was being set from when JS started executing, but `op_now` measures from an `std::time::Instant` stored in `OpState`, which is created at a completely different time. This caused `performance.timeOrigin` to be very incorrect. This PR corrects the origin and also cleans up some of the timer code. Compared to `Date.now()`, `performance`'s time origin is now consistently within 5us (0.005ms) of system time. ![image](https://github.com/user-attachments/assets/0a7be04a-4f6d-4816-bd25-38a2e6136926)
2024-09-03BREAKING(permissions): remove --allow-hrtime (#25367)Luca Casonato
Remove `--allow-hrtime` and `--deny-hrtime`. We are doing this because it is already possible to get access to high resolution timers through workers and SharedArrayBuffer. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-06-06refactor: remove `PermissionsContainer` in deno_runtime (#24119)David Sherret
Also removes permissions being passed in for node resolution. It was completely useless because we only checked it for reading package.json files, but Deno reading package.json files for resolution is perfectly fine. My guess is this is also a perf improvement because Deno is doing less work.
2024-03-11chore: enable clippy unused_async rule (#22834)David Sherret
2024-03-01perf(cli): use new deno_core timers (#22569)Matt Mastracci
Improves #19100 Fixes #20356 Replaces #20428 Changes made in deno_core to support this: - [x] Errors must be handled in setTimeout callbacks - [x] Microtask ordering is not-quite-right - [x] Timer cancellation must be checked right before dispatch - [x] Timer sanitizer - [x] Move high-res timer to deno_core - [x] Timers need opcall tracing
2024-02-16chore(ext/web): refactor timer ops before landing op sanitizer (#22435)Matt Mastracci
Splitting the sleep and interval ops allows us to detect an interval timer. We also remove the use of the `op_async_void_deferred` call. A future PR will be able to split the op sanitizer messages for timers and intervals.
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-10-26refactor: op_sleep uses op2 macro (#20908)Bartek Iwańczuk
Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-25chore: update deno_core and port all remaining ops to `op2` (#20954)Bartek Iwańczuk
Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-09refactor: remove TimersPermissions::check_unstable (#20831)Bartek Iwańczuk
This is dead code that was not used in any way. Ref https://github.com/denoland/deno/pull/20797
2023-10-05refactor: rewrite several extension ops to op2 (#20457)Bartek Iwańczuk
Rewrites following extensions: - `ext/web` - `ext/url` - `ext/webstorage` - `ext/io` --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-04Revert "refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' ↵Bartek Iwańczuk
(#20303) (#20370) This reverts commit https://github.com/denoland/deno/commit/83426be6eead06c680ae527468aeaf8723543ff2. Includes a regression test.
2023-09-02refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303)Bartek Iwańczuk
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-06-26chore: fix typos (#19572)Martin Fischer
2023-05-17feat(ext/web): Request higher-resolution timer on Windows if user requests ↵Matt Mastracci
setTimeout w/short delay (#19149) If a timer is requested with <=100ms resolution, request the high-res timer. Since the default Windows timer period is 15ms, this means a 100ms timer could fire at 115ms (15% late). We assume that timers longer than 100ms are a reasonable cutoff here. The high-res timers on Windows are still limited. Unfortuntely this means that our shortest duration 4ms timers can still be 25% late, but without a more complex timer system or spinning on the clock itself, we're somewhat bounded by the OS' scheduler itself.
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-17chore: update to Rust 1.66.0 (#17078)linbingquan
2022-10-17perf(ext/web): optimize timer cancellation (#16316)Divy Srivastava
Towards #16315 It created a bunch of Error objects and rejected the promise. This patch changes `op_sleep` to resolve with `true` if it was cancelled.
2022-09-07perf(ops): inline &[u8] arguments and enable fast API (#15731)Divy Srivastava
2022-09-06perf(runtime): short-circuit `queue_async_op` for Poll::Ready (#15773)Divy Srivastava
2022-08-28perf: use fast api for op_now (#15643)Divy Srivastava
2022-08-16perf: improve performance.now (#15481)Ryan Dahl
2022-07-26chore(ops): Remove unused arguments from ops (#15315)Aapo Alasuutari
2022-07-22Revert "feat(ops): V8 Fast Calls (#15122)" (#15276)Divy Srivastava
This reverts commit 03dc3b8972f460e40d0b75fc3207cae9fe4f60da.
2022-07-22feat(ops): V8 Fast Calls (#15122)Divy Srivastava
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-13Remove unstable Deno.sleepSync (#14719)Ryan Dahl
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-05-13chore(runtime): Make some ops in ext and runtime infallible. (#14589)Andreu Botella
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-03-14feat(ops): custom arity (#13949)Aaron O'Mullan
Also cleanup & drop ignored wildcard op-args
2022-03-14feat(core): codegen ops (#13861)Divy Srivastava
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-02-15chore(ext/timers): move ext/timers to ext/web (#13665)Andreu Botella