Skip to content

Performance: Hard performance hit when highlighting JavaScript with banner-comment #2656

@Schleuse

Description

@Schleuse

I've noticed a hard performance hit when trying to highlight a comment in banner-style:

//////////////////////////////////////
// EXTRA FANCY COMMENT NOBODY NEEDS //
//////////////////////////////////////
console.log("fancy");

Highlighting this snippet takes around 5 Seconds on my machine

Somebody posted a similar comment to this in our Mattermost Chat (which uses highlight.js) and rendered the channel virtually unusable due to the load on the clients.

I've built a Codepen which isolates the problem: Codepen

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