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:
@@ -15449,18 +15449,19 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
|
|||||||
lfs3_alloc_discard(lfs3);
|
lfs3_alloc_discard(lfs3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// setup treediff buffer
|
// TODO rm me
|
||||||
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
|
// // setup treediff buffer
|
||||||
if (lfs3->cfg->treediff_buffer) {
|
// #if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
|
||||||
lfs3->treediff.buffer = lfs3->cfg->treediff_buffer;
|
// if (lfs3->cfg->treediff_buffer) {
|
||||||
} else {
|
// lfs3->treediff.buffer = lfs3->cfg->treediff_buffer;
|
||||||
lfs3->treediff.buffer = lfs3_malloc(lfs3->cfg->treediff_size);
|
// } else {
|
||||||
if (!lfs3->treediff.buffer) {
|
// lfs3->treediff.buffer = lfs3_malloc(lfs3->cfg->treediff_size);
|
||||||
err = LFS3_ERR_NOMEM;
|
// if (!lfs3->treediff.buffer) {
|
||||||
goto failed;
|
// err = LFS3_ERR_NOMEM;
|
||||||
}
|
// goto failed;
|
||||||
}
|
// }
|
||||||
#endif
|
// }
|
||||||
|
// #endif
|
||||||
|
|
||||||
// check that the size limits are sane
|
// check that the size limits are sane
|
||||||
#ifndef LFS3_RDONLY
|
#ifndef LFS3_RDONLY
|
||||||
@@ -15649,11 +15650,12 @@ static int lfs3_deinit(lfs3_t *lfs3) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
|
// TODO rm me
|
||||||
if (!lfs3->cfg->treediff_buffer) {
|
// #if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
|
||||||
lfs3_free(lfs3->treediff.buffer);
|
// if (!lfs3->cfg->treediff_buffer) {
|
||||||
}
|
// lfs3_free(lfs3->treediff.buffer);
|
||||||
#endif
|
// }
|
||||||
|
// #endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,12 +465,13 @@ struct lfs3_cfg {
|
|||||||
lfs3_size_t lookahead_size;
|
lfs3_size_t lookahead_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Size of the treediff buffer in bytes. A larger treediff buffer speeds
|
// TODO rm me
|
||||||
// up tree diffing in BMAPSLOW and BMAPFAST modes. The treediff buffer
|
// // Size of the treediff buffer in bytes. A larger treediff buffer speeds
|
||||||
// also uses a compact bitmap, and sizes >block_count/8 have no effect.
|
// // up tree diffing in BMAPSLOW and BMAPFAST modes. The treediff buffer
|
||||||
#if !defined(LFS3_RDONLY) && defined(LFS3_BMAP)
|
// // also uses a compact bitmap, and sizes >block_count/8 have no effect.
|
||||||
lfs3_size_t treediff_size;
|
// #if !defined(LFS3_RDONLY) && defined(LFS3_BMAP)
|
||||||
#endif
|
// lfs3_size_t treediff_size;
|
||||||
|
// #endif
|
||||||
|
|
||||||
// Flags indicating what gc work to do during lfs3_gc calls.
|
// Flags indicating what gc work to do during lfs3_gc calls.
|
||||||
#ifdef LFS3_GC
|
#ifdef LFS3_GC
|
||||||
@@ -520,11 +521,12 @@ struct lfs3_cfg {
|
|||||||
void *lookahead_buffer;
|
void *lookahead_buffer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Optional statically allocated treediff buffer. Must be treediff_size.
|
// TODO rm me
|
||||||
// By default lfs3_malloc is used to allocate this buffer.
|
// // Optional statically allocated treediff buffer. Must be treediff_size.
|
||||||
#if !defined(LFS3_RDONLY) && defined(LFS3_BMAP)
|
// // By default lfs3_malloc is used to allocate this buffer.
|
||||||
void *treediff_buffer;
|
// #if !defined(LFS3_RDONLY) && defined(LFS3_BMAP)
|
||||||
#endif
|
// void *treediff_buffer;
|
||||||
|
// #endif
|
||||||
|
|
||||||
// Optional upper limit on length of file names in bytes. No downside for
|
// Optional upper limit on length of file names in bytes. No downside for
|
||||||
// larger names except the size of the info struct which is controlled by
|
// larger names except the size of the info struct which is controlled by
|
||||||
@@ -937,11 +939,12 @@ typedef struct lfs3 {
|
|||||||
} lookahead;
|
} lookahead;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
|
// TODO rm me
|
||||||
struct lfs3_treediff {
|
// #if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_BMAP)
|
||||||
uint8_t *buffer;
|
// struct lfs3_treediff {
|
||||||
} treediff;
|
// uint8_t *buffer;
|
||||||
#endif
|
// } treediff;
|
||||||
|
// #endif
|
||||||
|
|
||||||
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY)
|
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY)
|
||||||
const lfs3_data_t *graft;
|
const lfs3_data_t *graft;
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
BENCH_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
BENCH_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
||||||
BENCH_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
BENCH_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
||||||
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||||
BENCH_DEFINE(TREEDIFF_SIZE, 16 ) \
|
|
||||||
BENCH_DEFINE(GC_FLAGS, 0 ) \
|
BENCH_DEFINE(GC_FLAGS, 0 ) \
|
||||||
BENCH_DEFINE(GC_STEPS, 0 ) \
|
BENCH_DEFINE(GC_STEPS, 0 ) \
|
||||||
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||||
@@ -155,7 +154,6 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
#ifdef LFS3_BMAP
|
#ifdef LFS3_BMAP
|
||||||
#define BENCH_BMAP_CFG \
|
#define BENCH_BMAP_CFG \
|
||||||
.treediff_size = TREEDIFF_SIZE, \
|
|
||||||
.bmap_scan_thresh = BMAP_SCAN_THRESH,
|
.bmap_scan_thresh = BMAP_SCAN_THRESH,
|
||||||
#else
|
#else
|
||||||
#define BENCH_BMAP_CFG
|
#define BENCH_BMAP_CFG
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
TEST_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
TEST_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
||||||
TEST_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
TEST_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
||||||
TEST_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
TEST_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||||
TEST_DEFINE(TREEDIFF_SIZE, 16 ) \
|
|
||||||
TEST_DEFINE(GC_FLAGS, 0 ) \
|
TEST_DEFINE(GC_FLAGS, 0 ) \
|
||||||
TEST_DEFINE(GC_STEPS, 0 ) \
|
TEST_DEFINE(GC_STEPS, 0 ) \
|
||||||
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||||
@@ -146,7 +145,6 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
#ifdef LFS3_BMAP
|
#ifdef LFS3_BMAP
|
||||||
#define TEST_BMAP_CFG \
|
#define TEST_BMAP_CFG \
|
||||||
.treediff_size = TREEDIFF_SIZE, \
|
|
||||||
.bmap_scan_thresh = BMAP_SCAN_THRESH,
|
.bmap_scan_thresh = BMAP_SCAN_THRESH,
|
||||||
#else
|
#else
|
||||||
#define TEST_BMAP_CFG
|
#define TEST_BMAP_CFG
|
||||||
|
|||||||
Reference in New Issue
Block a user