bmap: Dropped treediff buffers for now

We're not currently using these (at the moment it's unclear if the
original intention behind the treediff algorithms is worth pursuing),
and they are showing up in our heap benchmarks.

The good news is that means our heap benchmarks are working.

Also saves a bit of code/ctx in bmap mode:

                code          stack          ctx
  before:      37024           2352          684
  after:       37024 (+0.0%)   2352 (+0.0%)  684 (+0.0%)

                code          stack          ctx
  bmap before: 38752           2456          812
  bmap after:  38704 (-0.1%)   2456 (+0.0%)  800 (-1.5%)
This commit is contained in:
Christopher Haster
2025-08-15 16:53:10 -05:00
parent 232f039ccc
commit 14d0c4121c
4 changed files with 38 additions and 37 deletions
+19 -17
View File
@@ -15449,18 +15449,19 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
lfs3_alloc_discard(lfs3);
#endif
// setup treediff buffer
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
if (lfs3->cfg->treediff_buffer) {
lfs3->treediff.buffer = lfs3->cfg->treediff_buffer;
} else {
lfs3->treediff.buffer = lfs3_malloc(lfs3->cfg->treediff_size);
if (!lfs3->treediff.buffer) {
err = LFS3_ERR_NOMEM;
goto failed;
}
}
#endif
// TODO rm me
// // setup treediff buffer
// #if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
// if (lfs3->cfg->treediff_buffer) {
// lfs3->treediff.buffer = lfs3->cfg->treediff_buffer;
// } else {
// lfs3->treediff.buffer = lfs3_malloc(lfs3->cfg->treediff_size);
// if (!lfs3->treediff.buffer) {
// err = LFS3_ERR_NOMEM;
// goto failed;
// }
// }
// #endif
// check that the size limits are sane
#ifndef LFS3_RDONLY
@@ -15649,11 +15650,12 @@ static int lfs3_deinit(lfs3_t *lfs3) {
}
#endif
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
if (!lfs3->cfg->treediff_buffer) {
lfs3_free(lfs3->treediff.buffer);
}
#endif
// TODO rm me
// #if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
// if (!lfs3->cfg->treediff_buffer) {
// lfs3_free(lfs3->treediff.buffer);
// }
// #endif
return 0;
}