I don't see why it couldn't be cheap if the editor always enforced being structurally valid? Then AST transformations are as fast as modifying a tree. A comment node would just wrap the necessary items and could unwrap them in linear/constant time.
No comments yet.