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

[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.

1 points | by szmarczak 2 hours ago

2 comments