Repository navigation
[fork twin] Performance: keep the time origin per environment - #25
Open
matthargett wants to merge 6 commits into
Open
matthargett wants to merge 6 commits into
matthargett wants to merge 6 commits into
Conversation
performance.now() measured from one process-wide start time that every Initialize() rewrote. With Workers each runtime initializes the polyfill on its own thread, so ThreadSanitizer reports the write race, and every new worker also moved the main realm's clock backwards. Capture the origin per environment in the now() closure, as each realm has its own time origin on the web, and use steady_clock, which cannot step. (cherry picked from commit 2391b0d)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Two runtimes: after the second initializes the polyfill, the first one's performance.now() must not go backwards. Fails against the process-wide origin (the second Initialize reset it to zero).
## Summary Follow-up to BabylonJS#230 (comment). The UTF-16 decoder previously dropped a trailing odd byte and created JavaScript strings from unpaired surrogates. Replacement mode in the Encoding Standard requires U+FFFD for both, in either endianness. `DecodeUtf16` now: - emits U+FFFD for a leftover odd byte - emits U+FFFD for a lone lead or trail surrogate - treats a lead followed by a non-trail as one replacement, then reprocesses the second unit - treats an unpaired lead plus a leftover odd byte as a single end-of-queue replacement The README describes this behavior and the still-unsupported `fatal` option. ## Timer cleanup after rebase Correction to the original description, per [Gary's review](BabylonJS#235 (review)): `Dispatch` always passed `0`, so the `id == 0` branch was **always taken**. The **nonzero ID-reuse path** was dead. The latest `main` already includes the timer refactor from BabylonJS#232, which removes `DispatchImpl` and guards against duplicate-ID insertion. The rebase keeps that implementation unchanged and drops this PR's superseded timer changes. The remaining diff contains only TextDecoder, its documentation, and the UTF-16 regression cases. ## Regression coverage - Trailing odd byte, both endiannesses - Lone lead / lone trail, both endiannesses - Lead + BMP (`U+D800` then `'A'`) produces `"\uFFFDA"` - Lead + leftover odd byte produces a single `"\uFFFD"` Existing valid-pair and BOM cases are unchanged. --------- Co-authored-by: Branimir Karadzic <branimirkaradzic@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: da74bc94-a7dc-4817-bd81-59b5c6b123fc
## Context `build-linux.yml` set job-level `CC`/`CXX` env alongside the `-D CMAKE_C_COMPILER` / `-D CMAKE_CXX_COMPILER` configure flags. The `-D` flags already select the compiler for both the gcc and clang matrix legs, so the env block was redundant. No behavior change: on the parallel UrlLib CI cleanup both the gcc and clang Linux jobs stayed green with the env removed. The Run Tests step's `env` (`TSAN_OPTIONS` / `JSC_useConcurrentGC`) is untouched. Part of a small cross-repo consistency pass — UrlLib landed the same cleanup. BabylonNative was checked and intentionally left alone: its `build-linux.yml` env is load-bearing there (its configure passes no `-D` compiler flags). [Created by Copilot on behalf of @bghgary] Co-authored-by: Gary Hsu <223556219+Copilot@users.noreply.github.com>
[Created by Copilot on behalf of @bghgary] Native and JavaScript runtime tests for unrelated features were grouped together, making coverage hard to navigate. This change groups the existing tests by feature and packages the generated test bundle and fixtures together under `Assets`. The same tests continue to run through the existing runner. --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…abylonJS#257) Performance.TimeOriginIsPerEnvironment moves from Shared.cpp to Source/Tests.Performance.cpp, registered in the desktop and Android test targets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fork CI twin of BabylonJS#240.
performance.now()measured from a single process-wide start time that everyPerformance::Initializerewrote. Any host that runs more than oneAppRuntime(a second runtime, or a worker) therefore moves the first realm's clock backwards on each initialization, and with concurrent runtimes the write is a data race (ThreadSanitizer reports it once workers exist).Each realm has its own time origin on the web, so capture it per environment in the
now()closure, and measure withsteady_clock, which cannot step.Verified on macOS (JavaScriptCore): full
UnitTestsgreen. Fork twin: rebeckerspecialties/JsRuntimeHost#TWIN.