Skip to content

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

@rmcgregor1990

Description

@rmcgregor1990

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions