Commit 722ca4b
perf(core): remove inline cache from polymorphic serialization
Remove inline cache layer for polymorphic type handling:
**Serialization:**
- Remove _cachedTypeHandle and _cachedSerializer inline cache
- Remove volatile cache reads/writes
- Simplify to direct FastMap lookup after base type check
- Reduces memory overhead and eliminates cache maintenance cost
**Deserialization:**
- Remove _cachedTypeIdOut/_cachedTypeIdRef and cached deserializers
- Remove volatile cache reads/writes
- Simplify to direct FastMap lookup after exact type match check
- Consistent with serialization path
**Rationale:**
- FastMap already provides O(1) lookup performance
- Inline cache added complexity and volatile overhead
- Most polymorphic usage has limited subtype variance
- FastMap lookup is fast enough for typical use cases
- Simpler code is easier to maintain and optimize
This simplification maintains performance while reducing code complexity
and eliminating the memory/synchronization overhead of the inline cache.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 6bbaeea commit 722ca4b
2 files changed
Lines changed: 2 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | 167 | | |
173 | 168 | | |
174 | 169 | | |
| |||
335 | 330 | | |
336 | 331 | | |
337 | 332 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | 333 | | |
348 | 334 | | |
349 | 335 | | |
350 | 336 | | |
351 | | - | |
352 | | - | |
353 | 337 | | |
354 | 338 | | |
355 | 339 | | |
| |||
377 | 361 | | |
378 | 362 | | |
379 | 363 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | 364 | | |
390 | 365 | | |
391 | 366 | | |
392 | 367 | | |
393 | | - | |
394 | | - | |
395 | 368 | | |
396 | 369 | | |
397 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | 186 | | |
191 | 187 | | |
192 | 188 | | |
| |||
288 | 284 | | |
289 | 285 | | |
290 | 286 | | |
291 | | - | |
| 287 | + | |
292 | 288 | | |
293 | 289 | | |
294 | 290 | | |
295 | 291 | | |
296 | 292 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | 293 | | |
308 | 294 | | |
309 | 295 | | |
310 | 296 | | |
311 | 297 | | |
312 | | - | |
313 | | - | |
314 | 298 | | |
315 | 299 | | |
316 | 300 | | |
| |||
319 | 303 | | |
320 | 304 | | |
321 | 305 | | |
322 | | - | |
| 306 | + | |
0 commit comments