Skip to content

Performance issue with attachComments #114

@mamaniv

Description

@mamaniv

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions