Skip to content

Commit

Permalink
Added a quick comparison between ramcrc32bd and ramrsbd
Browse files Browse the repository at this point in the history
A bit more manual than I would've liked, compiled with:

  CC='arm-none-eabi-gcc -static -mthumb' CFLAGS='-DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR -DLFS_NO_ASSERT' make code stack

But then manually removed unused functions that couldn't be gced with
available info:

- ramrsbd_gf_p_scale (unused, ramrsbd_gf_p_xors overlaps)
- ramrsbd_gf_p_xor   (unused, ramrsbd_gf_p_xors overlaps)
- lfs_crc            (unused in ramrsbd)
- rtable.0/RAMRSBD_GF_LOG/RAMRSBD_GF_POW (attributes to tables)
- ramrsbd_gf_divmod  (unused, ramrsbd_gf_p_divmod1 overlaps)

Note the code/stack cost does NOT include the related table/buffer
costs.
  • Loading branch information
geky committed Oct 25, 2024
1 parent 1dd76cd commit 6db48cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PERF ?= perf

SRC ?= $(filter-out \
$(wildcard *.t.* *.b.* littlefs/*.t.* littlefs/*.b.*), \
$(wildcard *.c littlefs/*.c))
$(wildcard *.c littlefs/lfs_util.c))
OBJ := $(SRC:%.c=$(BUILDDIR)/%.o)
DEP := $(SRC:%.c=$(BUILDDIR)/%.d)
ASM := $(SRC:%.c=$(BUILDDIR)/%.s)
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ available. But the same idea can be extended to any other CRC, as long
as it has a sufficient [Hamming distance][hamming-distance] for the
expected number of bit-errors.

A quick comparison of current ram-ecc-bds:

| | code | tables | stack | buffers | runtime |
|:-----------|-------:|-------:|------:|---------:|-------------------------:|
| ramcrc32bd | 940 B | 64 B | 88 B | 0 B | $O\left(n^e\right)$ |
| ramrsbd | 1430 B | 512 B | 128 B | n + 4e B | $O\left(ne + e^2\right)$ |

See also:

- [littlefs][littlefs]
Expand Down
1 change: 1 addition & 0 deletions ramcrc32bd.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ int ramcrc32bd_erase(const struct lfs_config *cfg, lfs_block_t block) {
LFS_ASSERT(block < cfg->block_count);

// erase is a noop
(void)cfg;
(void)block;

RAMCRC32BD_TRACE("ramcrc32bd_erase -> %d", 0);
Expand Down

0 comments on commit 6db48cf

Please sign in to comment.