Skip to content

[Python3] Large import time cost paid for inline unittests #2909

Closed
@rmcgregor1990

Description

@rmcgregor1990
Contributor

Hey,

The python3 antlr runtime spend a large proportion of its import load time importing unittest.
This can profiled with pythons newish -X importtime option.
importtime.txt

My on system it takes ~150ms to import antlr4 and ~100ms of that time is spent importing unittest.
This seems to be like quite a high time cost to pay just the keep the tests inline with the source.

My current project involing creating a python command line tool, which utilises antlr, and I would ideally like to keep the startup time as low as possible.

Would you consider moving the unitests out of the source tree?

Cheers,
Rob

Activity

ericvergnaud

ericvergnaud commented on Sep 14, 2020

@ericvergnaud
Contributor

Hi,
sure please submit a PR

rmcgregor1990

rmcgregor1990 commented on Sep 14, 2020

@rmcgregor1990
ContributorAuthor

Upon further investigation it appears the tests defined within the src tree files are not even run as part of you're test suite.
The only tests run are defined in TestTokenStreamRewriter.py in the test tree.

I'll put together a PR.

ericvergnaud

ericvergnaud commented on Sep 15, 2020

@ericvergnaud
Contributor
ericvergnaud

ericvergnaud commented on Sep 15, 2020

@ericvergnaud
Contributor
added this to the 4.9 milestone on Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @parrt@ericvergnaud@rmcgregor1990

      Issue actions

        [Python3] Large import time cost paid for inline unittests · Issue #2909 · antlr/antlr4