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
In the worst case, dependencies resolve in the order a → b → c.
doHeavyStuff will run:
a → 3 times
b → 2 times
c → 1 time
If doHeavyStuff() costs 1 second, the total cost becomes 6 seconds, instead of the optimal cost of 3s.
Solid’s naïve async evaluation model requires the user to memoize heavy work manually.
In effect, Solid inherits React like rendering model ( rerender on any dependency change until they all settle, then it is back to solid model).
Because Solid cannot detect async at compile time, it cannot automatically hoist or short‑circuit heavy expressions.
The user must optimize these cases manually.
Practical Options
Memoize heavy work — the pragmatic, reliable solution
Use a helper like revealOn - clean separation, avoids extra memo layers
Manual hoisting - fine for small expressions, ad‑hoc but effective
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Solid 2.0: Understanding Async Rendering Costs
Solid 2.0 evaluates expressions repeatedly until all async parts of the expression are resolved.
Here,
a,b, andcare unresolved async memos.As each resolves, Solid re‑evaluates:
an additional three times, once per dependency settling with its initial value.
This is cheap. Not free, but cheap (with a pure async dependency)
(illustrate the expression evaluation, note that both
a,b,care already inflight, memos are eager in solid not lazy)When the Expression Is Heavy
Consider:
In the worst case, dependencies resolve in the order
a → b → c.doHeavyStuffwill run:a→ 3 timesb→ 2 timesc→ 1 timeIf
doHeavyStuff()costs 1 second, the total cost becomes 6 seconds, instead of the optimal cost of 3s.Solid’s naïve async evaluation model requires the user to memoize heavy work manually.
In effect, Solid inherits React like rendering model ( rerender on any dependency change until they all settle, then it is back to solid model).
Mitigating the Cost
1. Move Heavy Work Into a Memo
2. Hoist Async Dependencies Early
Short‑circuit heavy work until all deps resolve:
3. Use a Helper
Why This Matters
Solid 2.0 tries hard to hide async from the user, but the hidden cost of async resolution still exists.
Solid’s compiler has no awareness that:
a,b,care async signalsdoHeavyStuffis expensive or IO‑boundThere is no syntax‑level opt‑in to mark async reads:
Because Solid cannot detect async at compile time, it cannot automatically hoist or short‑circuit heavy expressions.
The user must optimize these cases manually.
Practical Options
revealOn- clean separation, avoids extra memo layersAll reactions