Commit e449e73
Optimize dump_object shape() by replacing string join with dictionary tree
Following the same pattern as the previous optimization of $mol_vary riches Map, replaced the string-based shape lookup in dump_object with a dictionary tree structure.
**Before:**
```typescript
const key = keys1.join('\0') // ['a', 'b'] → 'a\0b'
const keys2 = shapes.get(key)
```
**After:**
```typescript
// Traverse dictionary tree: shapes -> 'a' -> 'b' -> cached_keys_array
let node: ShapeNode | any[] | undefined = shapes
for (const key of keys1) {
node = node?.get(key)
}
```
**Benefits:**
- No string concatenation overhead
- Direct Map traversal instead of string operations
- Shared prefixes in tree structure for better memory usage
- Consistent with the riches Map optimization
Addresses comment from nin-jin: "dump_object тоже обнови - шейпы POJO тоже должны быть оптимизированы"
Related to #806
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 01353ef commit e449e73
1 file changed
+42
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
225 | 227 | | |
226 | 228 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
231 | 268 | | |
232 | 269 | | |
233 | 270 | | |
| |||
0 commit comments