Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Loading assets from the cache is significantly slower than from the binary #1753

Copy link
Copy link

Description

@Enselic
Issue body actions

Step-by-step:

  1. Measure the time it takes bat to highlight examples/simple.rs without cached assets, i.e. when the assets integrated into the binary are used:
% rm -rf ~/.cache/bat
% hyperfine --export-markdown /dev/tty 'bat --color always examples/simple.rs'
Command Mean [ms] Min [ms] Max [ms] Relative
bat --color always examples/simple.rs 107.4 ± 2.1 104.1 112.5 1.00
  1. Create cached assets that are identical to the integrated assets:
% mkdir -p ~/.cache/bat
% echo "---\nbat_version: 0.18.2" > ~/.cache/bat/metadata.yaml
% cp assets/syntaxes.bin ~/.cache/bat/syntaxes.bin
% cp assets/themes.bin ~/.cache/bat/themes.bin
  1. Measure again
% hyperfine --export-markdown /dev/tty 'bat --color always examples/simple.rs'
Command Mean [ms] Min [ms] Max [ms] Relative
bat --color always examples/simple.rs 115.0 ± 2.1 111.9 120.1 1.00

Expected result

There is no significant difference.

Actual result

There is a significant difference.

I will soon create a PR with a proposed fix.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.