Repository navigation
[Docs] Actors and locks: benchmark, lock census of the frame and rules - #66
Merged
Merged
Conversation
added 2 commits
October 3, 2026 16:26
Research note docs/proposals/ActorsAndLocks.md with its two tools: - Examples/ConcurrencyBench: standalone package that measures a Swift actor against NSLock, NSRecursiveLock, OSAllocatedUnfairLock, Mutex and a serial queue (uncontended, contended, latency seen by a synchronous thread with the thread pool idle and saturated, a pass over 10,000 entities). - LockCensusTests: opt-in render test (UNTOLD_LOCK_CENSUS=1) that counts every NSLock / NSRecursiveLock acquisition in renderer.draw and attributes it to the engine function that made it. No engine code changes.
…velop Same text as the upstream PR (untoldengine#1294), so the note merges cleanly at the next sync. The counts are identical; the frame times are a second set of runs.
miogds
pushed a commit
that referenced
this pull request
Oct 3, 2026
miogds
pushed a commit
that referenced
this pull request
Oct 3, 2026
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.
What
Research on two questions, with the tools to re-run it. No engine code changes.
Contents
docs/proposals/ActorsAndLocks.md: results, proposed rules for engine and editor, review of the critical path, how to reproduce, limits.Examples/ConcurrencyBench: standalone package (macOS 15) that measures an actor againstNSLock,NSRecursiveLock,OSAllocatedUnfairLock,Mutexand a serial queue.Tests/UntoldEngineRenderTests/LockCensusTests.swift: opt-in test (UNTOLD_LOCK_CENSUS=1, skipped otherwise) that counts everyNSLock/NSRecursiveLockacquisition inrenderer.drawand names the function that made it.Findings (Mac16,5, release builds)
Task; the wait is 7 µs with the thread pool idle and 2.4 to 24 ms (median) with the pool full of asset jobs. A lock stays under 1 µs. Actors are fine at the async edges (the three the engine has) and in the editor.sceneglobal getter, the component-id map and the scene-channel render-mode check.renderer.drawby 6 to 7 %; removing per-access locking (ceiling, not a shippable change) cuts it by 25 to 28 %.Verified
swift build -c releaseofExamples/ConcurrencyBench, all five sections run.LockCensusTestsrun in debug and release at 1,000 and 4,000 cubes; skipped without the environment variable.swiftformat --linton the new Swift files, commit prefix check.