Assigning a string is actually quite complex when dealing with scalars.
- Call GET magic on the scalar being assigned if any.
- Check what the scalar being assigned contains (which happens to be a string).
- Upgrade the scalar to which we are assigning to one that can contain a string if needed.
- Clear whatever value the scalar to which we are assigning contains. (This can require reducing reference counts (which can require calling destructors, etc), reducing COW counts, resetting OOB vars, etc.)
- Finally, we can start the copy. That can happen one of three ways. Hopefully, it's just a question of copying a pointer and incrementing the COW reference count.
(I definitely skipped some steps. I got tired of typing.)
Walking the optree, on the other hand, is simply following a linked list. (Effectively, op = op->next.) This is way simpler than assigning a string.