Skip to content

Pre-processor definitions slow down the parser significantly #295

Closed
@albertziegenhagel

Description

@albertziegenhagel

Is your feature request related to a problem? Please describe.
I realized that the parser gets slow when one adds a bunch of pre-processor definitions via --pp_defs. As an example I take one of the source files from our code base with ~10'000 lines of code an measure the time of

python -m fortls --debug_filepath=c:\path\to\my\file.F --debug_symbols

which takes ~1 second. But if I add 20 random preprocessor definitions (that are not relevant for this file at all) like

python -m fortls --debug_filepath=c:\path\to\my\file.F --debug_symbols --pp_defs={"DOES_NOT_EXIST1":"1","DOES_NOT_EXIST2":"1","DOES_NOT_EXIST3":"1","DOES_NOT_EXIST4":"1","DOES_NOT_EXIST5":"1","DOES_NOT_EXIST6":"1","DOES_NOT_EXIST7":"1","DOES_NOT_EXIST8":"1","DOES_NOT_EXIST9":"1","DOES_NOT_EXIST10":"1","DOES_NOT_EXIST11":"1","DOES_NOT_EXIST12":"1","DOES_NOT_EXIST13":"1","DOES_NOT_EXIST14":"1","DOES_NOT_EXIST15":"1","DOES_NOT_EXIST16":"1","DOES_NOT_EXIST17":"1","DOES_NOT_EXIST18":"1","DOES_NOT_EXIST19":"1","DOES_NOT_EXIST20":"1"}

this takes ~9.8 seconds.

Describe the solution you'd like
I would expect pre-processor definitions to not have such a severe effect on the parsing speed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions