Enable fast string compares for indexed list

This commit is contained in:
Sergey Chernov 2026-02-16 17:58:05 +03:00
parent fdb23b3a76
commit 09b1eb68ae
2 changed files with 8 additions and 2 deletions

View File

@ -3533,6 +3533,11 @@ class BytecodeCompiler(
val elementClass = listElementClassBySlot[receiver.slot] ?: listElementClassFromReceiverRef(ref.targetRef)
if (elementClass != null) {
slotObjClass[dst] = elementClass
if (elementClass == ObjString.type && elementClass.isClosed) {
stableObjSlots.add(dst)
} else {
stableObjSlots.remove(dst)
}
}
return CompiledValue(dst, SlotType.OBJ)
}

View File

@ -16,7 +16,8 @@ Candidates (not started)
4) Range/loop hot path (done)
- Reuse a cached ObjVoid slot for if-statements in statement context (avoids per-iteration CONST_OBJ).
- MixedCompareBenchmarkTest: 249 ms -> 247 ms.
5) String ops
- Extend fast path for string comparisons in hot loops.
5) String ops (done)
- Mark GET_INDEX results as stable only for closed ObjString elements to enable fast compares.
- MixedCompareBenchmarkTest: 247 ms -> 240 ms.
6) Box/unbox audit
- Identify remaining BOX_OBJ / OBJ_TO_* in inner loops and eliminate when safe.