Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy load themes #1969

Merged
merged 3 commits into from
Dec 6, 2021
Merged

Lazy load themes #1969

merged 3 commits into from
Dec 6, 2021

Conversation

Enselic
Copy link
Collaborator

@Enselic Enselic commented Dec 1, 2021

To further improve upon #951: It is quite easy to start lazy-loading themes, and it can be done without any changes to syntect.

It makes bat start ~25% faster when syntaxes are also lazy loaded.

This might feel like overkill, but it is necessary if we want to be able to add new themes without feeling guilty about impacting startup time negatively.

Running hyperfine on bat --color=always tests/benchmarks/test-src/small-CpuInfo-file.cpuinfo:

Command Mean [ms] Min [ms] Max [ms] Relative
git master 99.6 ± 1.6 97.0 103.0 6.74 ± 0.35
git master + lazy themes 95.8 ± 1.0 94.5 98.6 6.49 ± 0.32
git master + lazy syntaxes 19.4 ± 0.9 18.0 22.0 1.31 ± 0.09
git master + lazy themes + lazy syntaxes 14.8 ± 0.7 13.5 16.5 1.00

This is for sharkdp#951. Syntax lazy-loading will come later and have a much bigger
impact, but lazy-loading of themes does not have negligible impact.
@Enselic
Copy link
Collaborator Author

Enselic commented Dec 1, 2021

Oops, forgot CHANGELOG.md. Will fix that after the first review round.

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! ❤️

@Enselic Enselic merged commit 7fceb48 into sharkdp:master Dec 6, 2021
@Enselic Enselic deleted the lazy-load-themes branch December 6, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants