perf: replace the per-file cache entries with a compact dir table - #197
Open
benjaminbruun wants to merge 2 commits into
Open
benjaminbruun wants to merge 2 commits into
benjaminbruun wants to merge 2 commits into
Conversation
Contributor
Firmware footprint delta —
|
| Memory | base | PR | Δ |
|---|---|---|---|
| Flash | 146.1 KiB | 146.8 KiB | +708 B |
| RAM | 72.3 KiB | 72.5 KiB | +160 B |
Section size changes (from the section headers)
+14 B .strtab (65698 -> 65712)
+128 B .symtab (82080 -> 82208)
+160 B bss (20722 -> 20882)
+132 B rodata (34508 -> 34640)
+580 B text (111776 -> 112356)
Top symbol changes (10 largest, from the symbol tables)
+288 B ss_dir_table_from_blob
+160 B fs_slots
+144 B ss_fopen
-130 B generate_dir_table_from_blob
+120 B ss_slot_acquire
-106 B f_cache_find_buffer
+100 B port_provision
+68 B ss_dir_find
+40 B ss_file_size
-34 B f_cache_find_by_name
Soft report — informational only. Base 418e66207ab626f4a312fdcf6d5656eb97d5c712 vs PR head.
benjaminbruun
force-pushed
the
perf/compact-dir-table
branch
from
August 28, 2026 13:53
c3d347b to
3a65b53
Compare
Every file cost a 28 B list entry plus a malloc'd path string although only ten files can hold content at once; an 8 B hashed dir entry plus a fixed slot table cuts the 98-file profile's table from 6.7 KB of heap to 0.8 KB and makes the ten-buffer cap real. Signed-off-by: Benjamin Bruun <bb@onomondo.com>
benjaminbruun
force-pushed
the
perf/compact-dir-table
branch
from
September 1, 2026 08:12
3a65b53 to
1147cf4
Compare
Signed-off-by: Benjamin Bruun <bb@onomondo.com>
Member
|
Overall very nice :D Currently deleting files is half supported (at least the nvs key is removed). Creating files is not supported. With this hashed approach updating the NVS DIR_ENTRY is gonna be harder as it can't be built from the context in memory. So the whole blob needs to be re-parsed, then updated and then re-written to the entry. Small price to pay for such a big win memory wise :P |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every file cost a 28 B cache entry plus a malloc'd path string although only ten files can hold content at once; an 8 B hashed dir entry plus a fixed slot table cuts the 98-file profile's table from 6.7 KB of heap to 0.8 KB and makes the ten-buffer cap real. Validated on an nRF9151-DK: system-heap peak 13,524 -> 8,640 B, attach unchanged, and a pre-existing provisioned NVS is read as-is. The footprint report will show +160 B RAM (the static slot table); the 4.9 KB heap saving is invisible to it.