gc: Moved incremental gc behind ifdef LFS_GC
Incremental gc, being stateful and not gc-able (ironic), was always
going to need to be conditionally compilable.
This moves incremental gc behind the LFS_GC define, so that we can focus
on the "default" costs. This cuts lfs_t in nearly half!
lfs_t with LFS_GC: 308
lfs_t without LFS_C: 168 (-45.5%)
This does save less code than one might expect though. We still need
most of the internal traversal/gc logic for things like block allocation
and orphan cleanup, so most of the savings is limited to the RAM storing
the incremental state:
code stack ctx
before: 37916 2608 768
after with LFS_CFG: 37944 (+0.1%) 2608 (+0.0%) 768 (+0.0%)
after without LFS_CFG: 37796 (-0.3%) 2608 (+0.0%) 620 (-19.3%)
On the flip side, this does mean most of the incremental gc
functionality is still availables in the lfsr_traversal_t APIs.
Applications with more advanced gc use-cases may actually benefit from
_not_ enabling the incremental gc APIs, and instead use the
lfsr_traversal_t APIs directly.
This commit is contained in:
@@ -145,14 +145,21 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_buffer_size = FILE_BUFFER_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS, \
|
||||
BENCH_GC_CFG \
|
||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||
.inline_size = INLINE_SIZE, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
|
||||
#ifdef LFS_GC
|
||||
#define BENCH_GC_CFG \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS,
|
||||
#else
|
||||
#define BENCH_GC_CFG
|
||||
#endif
|
||||
|
||||
#define BENCH_BDCFG \
|
||||
.erase_value = ERASE_VALUE, \
|
||||
.erase_cycles = ERASE_CYCLES, \
|
||||
|
||||
+10
-3
@@ -136,13 +136,20 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_buffer_size = FILE_BUFFER_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS, \
|
||||
TEST_GC_CFG \
|
||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||
.inline_size = INLINE_SIZE, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
.crystal_thresh = CRYSTAL_THRESH
|
||||
|
||||
#ifdef LFS_GC
|
||||
#define TEST_GC_CFG \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS,
|
||||
#else
|
||||
#define TEST_GC_CFG
|
||||
#endif
|
||||
|
||||
#define TEST_BDCFG \
|
||||
.erase_value = ERASE_VALUE, \
|
||||
|
||||
Reference in New Issue
Block a user