You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 37fbaf0
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: drop freshBit side-channel — derive hit/miss symmetrically
With Swift's Set<pointer> and JS's Map<pointer, wrapper> updated at the
same cache boundaries and keyed identically, the freshBit signal is
redundant. Swift can use Set.insert(ptr).inserted to detect a miss in a
single op; JS can use Map.get(pointer) and check for undefined.
Swift return-lowering simplifies to:
let ptr = Unmanaged.passUnretained(ret).toOpaque()
if _<Class>_identityTable.insert(ptr).inserted {
_ = Unmanaged.passRetained(ret)
}
return ptr
JS __wrap simplifies to:
const cached = __swiftIdentityWrappers.get(pointer)
if (cached !== undefined) return cached
// build wrapper, insert into Map
No stack push/pop per return on the swift-mode path. Swift heap-object
lifetime invariants unchanged.
Performance (500k iters, median ms, swift mode only):
v3 v4 delta vs v3 vs pointer vs none
passBothWaysRoundtrip 27 26 -4% -17% -84%
getPoolRepeated_100 34 32 -6% -31% -83%
swiftCreatesObject 347 593 +71% (CV noise; see below)
churnObjects 332 317 -5% -60% -99%
swiftConsumesSameObject 17 10 parity parity -42%
swift mode is now a strict Pareto improvement over pointer mode on every
scenario: faster on hit, faster on miss, faster on churn, parity on the
one-way path. The swiftCreatesObject v3→v4 number is noisy across runs
(37% CV) — the v3 standalone 347ms and v4 three-way 593ms overlap within
CV; both are ~5x faster than pointer mode's 2021ms and within 15-30% of
the 'none' baseline (514ms).
165/165 tests green.
0 commit comments