Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Crammed LFSR_CAT_NAME to reuse the wasted word in the name lfsr_data_t
One annoying thing about lfsr_data_t is when representing in-RAM buffers, the last word of the struct goes completely unused. This commit attempts to save this word of RAM in file names by forcibly (hackily?) truncating the name's lfsr_data_t: .---+---+---+---. . . . . .---+---+---+---. . . . . .---+---+---+---. |0| did_size | |0| did_size | | did_data | +---+---+---+---+ +---+---+---+---+ | | | did_ptr ------. | did_ptr ------. | | +---+---+---+---+ | +---+---+---+---+ | | | | (unused) | | | (unused) | | | | +---+---+---+---+ . | . . +---+---+---+---+ . | . . +---+---+---+---+ |0| name_size | | |0| name_size | | | name_size | +---+---+---+---+ | +---+---+---+---+ | | | | name_ptr | | | name_ptr | | | | +---+---+---+---+ | +---+---+---+---+ | | | | (unused) | | | did | <-' | | +---+---+---+---+ . | . . | | . . . . '---+---+---+---' | did | <-' '---+---+---+---' | | '---+---+---+---' Curiously, this didn't seem to save RAM but saved a bit of code cost? I guess this is because 1. file names, despite being very common, don't occur on the stack hot-path that starts at lfsr_file_sync, and 2. while we don't save stack cost, sometimes the reduced stack pressure can reduce stack manipulation instructions: code stack before: 33728 2776 after: 33672 (-0.2%) 2776 (+0.0%) If we look at the per-function stack cost, we can see the expected minor stack savings in most functions, albeit outside of the stack hot-path: function oframe olimit nframe nlimit dframe dlimit lfsr_file_open 16 2040 16 2032 +0 -8 (+0.0%, -0.4%) lfsr_rename 240 2128 232 2120 -8 -8 (-3.3%, -0.4%) lfsr_remove 176 2064 168 2056 -8 -8 (-4.5%, -0.4%) lfsr_file_opencfg 136 2024 128 2016 -8 -8 (-5.9%, -0.4%)
- Loading branch information