Commit 3575b36
perf(validator): fast path tag [COMPUTE] for subtag-less tags
`MonomorphicTagImpl[COMPUTE]` is called by `validateTag`/`valueForTag` on
every reference read. For a tag with no subtag — property tags, cell tags,
plain dirtyable/updatable tags, i.e. the overwhelming majority — the result
is always just `revision` (kept current by `dirtyTag`). The
`lastChecked`/`isUpdating`/cycle-guard/`try-finally` machinery exists only to
memoize subtag recursion, so it is pure overhead for these tags.
Return `this.revision` directly when `subtag === null`. The combinator path
is unchanged (it now reuses the already-read `subtag`).
Microbench (1000 subtag-less [COMPUTE]s during a revalidation pass):
~4.71µs -> ~3.90µs (~17%), and no try/finally or field writes on the read.
Full browser suite green: 9340 tests, 9323 pass, 17 skip, 0 fail.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8a4840a commit 3575b36
1 file changed
Lines changed: 27 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
125 | 137 | | |
126 | 138 | | |
127 | 139 | | |
| |||
135 | 147 | | |
136 | 148 | | |
137 | 149 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
146 | 162 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
156 | 166 | | |
157 | 167 | | |
158 | 168 | | |
| |||
0 commit comments