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

Add block cache #469

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add block cache #469

wants to merge 1 commit into from

Conversation

nicholasbishop
Copy link
Owner

@nicholasbishop nicholasbishop commented Mar 23, 2025

This cache makes the library much faster in non-hosted environments where the disk is being access directly (e.g. UEFI). There is also a small performance improvement in hosted environments (e.g. Linux).

Example numbers (no-cache -> with-cache), running this command:
cargo xtask bench test_data/chromiumos_root.bin

Device 1 Linux: 9.28s -> 8.31s
Device 2 Linux: 1.23s -> 1.15s
Device 1 Uefi: 52.49s -> 17.78s
Device 2 Uefi: 22.33s -> 9.18s

There is a memory cost to the cache of course. Currently there's no way to tune it for memory-constrained environments; we might want to add something like that in the future if someone has a use case for it.

Currently the cache is very simple and only stores block data. In the future we might want to cache additional data, e.g. checksum verification.

See docstrings in src/block_cache.rs for implementation details of the cache.

#467

@nicholasbishop nicholasbishop force-pushed the bishop-benchy-3 branch 9 times, most recently from 9f799f8 to b4d2141 Compare March 30, 2025 02:10
@nicholasbishop nicholasbishop force-pushed the bishop-benchy-3 branch 5 times, most recently from 7a71f22 to 711306c Compare April 3, 2025 17:05
@nicholasbishop nicholasbishop changed the title WIP: add benchmark tool and basic block cache Add block cache Apr 3, 2025
@nicholasbishop nicholasbishop marked this pull request as ready for review April 3, 2025 17:06

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
This cache makes the library much faster in non-hosted environments
where the disk is being access directly (e.g. UEFI). There is also a
small performance improvement in hosted environments (e.g. Linux).

Example numbers (no-cache -> with-cache), running this command:
`cargo xtask bench test_data/chromiumos_root.bin`

Device 1 Linux: 9.28s -> 8.31s
Device 2 Linux: 1.23s -> 1.15s
Device 1 Uefi: 52.49s -> 17.78s
Device 2 Uefi: 22.33s -> 9.18s

There is a memory cost to the cache of course. Currently there's no way
to tune it for memory-constrained environments; we might want to add
something like that in the future if someone has a use case for it.

Currently the cache is very simple and only stores block data. In the
future we might want to cache additional data, e.g. checksum verification.

See docstrings in src/block_cache.rs for implementation details of the cache.
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.

None yet

1 participant