I encountered a performance issue using attachComments for large files with many comments.
The issue is related to lines 735 and 768 on estraverse.js that calls comments.splice(cursor, 1);.
Instead of calling splice, which is a very expensive operation that can cause performance issue if the comments array is very big, we can simply call cursor++.
I already tested it for my project and got an enormous performance improvement for attachComments, so it will be nice if we can apply this change too.
Thanks,
Niv