Settings

Theme

Claude Sonnet 4.6 thinking duplicates what it has said, wasting tokens

3 points by szmarczak 15 days ago · 2 comments · 1 min read


[response] So child iteration becomes O(subtree size) instead of O(children count). With Box<[PatId]> you get direct children in O(1).

[me] Sure, but I don't think rust-analyzer does something like tuple.args[index]. So the amount of steps is the same. When type checking, it iterates over the entire tree.

[thinking] ... But wait - there's still a real difference. With Box<[PatId]>, when you're at a Pat::Tuple, you can directly iterate its children without knowing anything about the subtree structure. With the range encoding, to get direct children you need to skip over subtrees. ...

---

Why does it waste tokens like this? It happens quite often.

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection