Skip to content

perf: allocate a chain's sectors for a whole write at once - #86

Open
francisdb wants to merge 2 commits into
mdsteele:masterfrom
francisdb:perf/bulk-sector-allocation
Open

perf: allocate a chain's sectors for a whole write at once#86
francisdb wants to merge 2 commits into
mdsteele:masterfrom
francisdb:perf/bulk-sector-allocation

Conversation

@francisdb

Copy link
Copy Markdown
Contributor

Builds on #85 (its commit is included here until it merges).

Growing a chain cost a FAT entry write for the new sector, another to link it, and a zero fill, per sector. A write past the end of a chain now takes all the sectors it needs first (Allocator::extend_chain_by), writes the FAT entries of each run of consecutive ids together, and skips the zero fill of sectors it fills completely; the unused tail of the last sector and set_len growth are still zeroed.

case before (#85) after
write to file, 50 x 1 MiB 21.3 ms 12.1 ms
write to file, 100 x 4 KiB 3.0 ms 0.5 ms
write to memory, 50 x 1 MiB 11.0 ms 8.3 ms

Chains went through the underlying reader or writer one sector per
call. Consecutive sectors are now read or written in a single call.
A write now allocates all the sectors it needs first, writes their FAT
entries together, and skips zeroing sectors it fills completely.
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.

1 participant