trussed icon indicating copy to clipboard operation
trussed copied to clipboard

Iteration optimisation

Open sosthene-nitrokey opened this issue 1 year ago • 2 comments

This is built on top of #104 and #96, and https://github.com/trussed-dev/littlefs2/pull/33

This PR:

Uses the apis added to https://github.com/trussed-dev/littlefs2/pull/33 to improve the skipping that happens each time in read_dir(_files)_next(). I think the operation is likely still $O(n)$ (with n being the number of files in the directory, but it should be much faster.

It also exposes read_dir(_files)_nth syscalls that make it possible to resume iteration at a certain point without having to iterate n time with read_dir(_files)_next, which is a $O(n^2)$ operation

sosthene-nitrokey avatar Mar 14 '23 09:03 sosthene-nitrokey

The bug mentioned in https://github.com/trussed-dev/littlefs2/pull/33 does not affect this PR anyway because the current behaviour of iteration is to consider any filesystem error as the end of the iteration, which means the bug does not change observed behaviour.

sosthene-nitrokey avatar Mar 14 '23 09:03 sosthene-nitrokey

In favor of this, needs some conflict fixing.

nickray avatar Apr 06 '23 12:04 nickray