Added LFSR_BTREE/SHRUB_NULL, dropped lfsr_btree_alloc

Our B-trees lazily allocate their root blocks, so it makes more sense
for this to be a macro. Added/adopted a similar LFSR_SHRUB_NULL for
consistency.

Unfortunately this added a bit of code. I think because GCC struggles to
optimize compound literals, which both LFSR_BTREE_NULL and
LFSR_SHRUB_NULL expand into:

           code          stack
  before: 33538           2624
  after:  33550 (+0.0%)   2624 (+0.0%)
This commit is contained in:
Christopher Haster
2024-05-27 02:54:23 -05:00
parent 8e50e4d259
commit 5d03416c82
3 changed files with 65 additions and 124 deletions
+3 -6
View File
@@ -42,8 +42,7 @@ code = '''
lfs_alloc_ckpoint(&lfs);
// create a btree
lfsr_btree_t btree;
lfsr_btree_alloc(&lfs, &btree) => 0;
lfsr_btree_t btree = LFSR_BTREE_NULL();
// set up a simulation to compare against
char *sim = malloc(N);
@@ -150,8 +149,7 @@ code = '''
lfs_alloc_ckpoint(&lfs);
// create a btree
lfsr_btree_t btree;
lfsr_btree_alloc(&lfs, &btree) => 0;
lfsr_btree_t btree = LFSR_BTREE_NULL();
// set up a simulation to compare against
char *sim = malloc(N);
@@ -254,8 +252,7 @@ code = '''
lfs_alloc_ckpoint(&lfs);
// create a btree
lfsr_btree_t btree;
lfsr_btree_alloc(&lfs, &btree) => 0;
lfsr_btree_t btree = LFSR_BTREE_NULL();
// set up a simulation to compare against
char *sim = malloc(N);