| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Marked with DO-NOT-MERGE as this approach isn't agreed upon at this point. |
Sorry, something went wrong.
|
Closing. We can make the diff smaller by keeping the Mapping, but the better approach is to make dataclasses faster. Let's continue in the isssue. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
_colorize constructs six different theme classes (and I expect more in the future), which are slow to build because they use dataclasses.
This makes the module as a whole slow to import, even the importer doesn't use a theme or doesn't use colour in the end.
If we switch to regular classes, the construction time is much faster. This PR also avoid the collections.abc import.
traceback
Below are import times for a macOS build with optimisations.
before: 15 ms
after: 6 ms
_colorize
before: 13 ms
after: ~0 ms