-
Notifications
You must be signed in to change notification settings - Fork 1
Startup time improvements
Christopher Hunt edited this page May 29, 2019
·
3 revisions
- Only make changes supported by profiling
- Qualify type-related imports under
quicken.lib._typing.MYPY_CHECK_RUNNING
and usefrom __future__ import annotations
(may be revisited later depending on whether we want Python 3.6 support) - Distinguish module import cost due to filesystem and actual execution with
strace -c python -X importtime -c 'import <module>'
. - When checking cost of module import in isolation make sure to take into account modules that will already be imported (e.g.
socket
,os
,re
, maybeimportlib
). - Use import stubbing (see
quicken.lib._imports
) as a last resort - prefer to remove dependencies entirely - Nit-picky time savings only really apply to library code - tests can use whatever they need to
Some nice things that unfortunately don't seem worth it for our use case (but this should be checked later):
- dataclasses - module execution time is longer than with basic class definitions
- pathlib - adds a few ms due to urllib.parse and ntpath