Skip to content

performance problem with comments and locations #1083

@alexander-akait

Description

@alexander-akait

Shorty - acorn has bad performance when you have minified file and the locations option enabled.

Original problem - webpack/webpack#14922.
Reproducible example - https://github.com/ling1726/webpack-minified-slow

Steps:

  • npm i
  • npm run start:slow

In example we don't use acorn directly, but it shows the problem well.

The problem happens here https://github.com/acornjs/acorn/blob/master/acorn/src/tokenize.js#L105, because file is big and it is only one line RegExp is very slow.

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