Replaced large struct macros with init functions
While they are a bit more annoying to call, init functions give the
compiler a chance to deduplicate common struct initialization logic. So
we should probably prefer init functions for any structs larger than a
couple words.
The cost of each init is small, but it really adds up!
code stack ctx
before: 38036 2608 752
after: 37844 (-0.5%) 2608 (+0.0%) 752 (+0.0%)
This commit is contained in:
@@ -61,7 +61,8 @@ code = '''
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// create a btree
|
||||
lfsr_btree_t btree = LFSR_BTREE_NULL();
|
||||
lfsr_btree_t btree;
|
||||
lfsr_btree_init(&btree);
|
||||
|
||||
// set up a simulation to compare against
|
||||
char *sim = malloc(N);
|
||||
@@ -1835,7 +1836,8 @@ code = '''
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// create a btree
|
||||
lfsr_btree_t btree = LFSR_BTREE_NULL();
|
||||
lfsr_btree_t btree;
|
||||
lfsr_btree_init(&btree);
|
||||
|
||||
// set up a simulation to compare against
|
||||
char *sim = malloc(N);
|
||||
@@ -3609,7 +3611,8 @@ code = '''
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// create a btree
|
||||
lfsr_btree_t btree = LFSR_BTREE_NULL();
|
||||
lfsr_btree_t btree;
|
||||
lfsr_btree_init(&btree);
|
||||
|
||||
// set up a simulation to compare against
|
||||
char *sim = malloc(N);
|
||||
|
||||
Reference in New Issue
Block a user