Skip to main content

14 posts tagged with "internals"

View All Tags

An effect as a literal, driven by one service

· 5 min read

An effect used to be a class instance that carried its own state and its own methods. It is now a plain object literal, and every effect on a channel is driven by one long-lived OIMEffectService. Two recorded pieces price the shape itself: with the hidden-class loss at a full GC held out, the class was 1.15–1.17× dearer to create and within a few percent of the literal on wake and dispose.

One map or two: where the row lives

· 5 min read

A keyed store can keep a row and its identity together — one Map<key, slot>, the row on the slot — or apart: a Map<key, row> for the data and a second Map<key, slot> whose identities are minted only when something needs one. Apart is the cheaper first load. It is dearer on every write once anything is watching, and dearer by 3.5× when a subscription asks for an identity.

Subscribing to the identity, and what it costs to leave

· 6 min read

An effect in this engine subscribes to the slot it was handed; the 3.12.1 engine subscribed a handler under a key. Three pieces recorded on one evening put the two side by side on the wake and on the mount-and-release cycle. The wake went to the slot subscription in all three. The mount-and-release cycle went against it until the detach stopped searching for itself, and then came out 1.13× cheaper.

Where an index keeps the key a row was filed under

· 4 min read

When a row is written, an index has to know which bucket the row was in before, so it can tell whether the row moved. OIMDB keeps that previous answer in a cell on the row's own slot. One recorded piece prices it against the two alternatives — recalling it from a Map keyed by the row, and recomputing and diffing through a pair of Sets — at 1.61× and 2.67× cheaper per row per write.