johang / btfs

A bittorrent filesystem based on FUSE.
GNU General Public License v3.0
3.88k stars 145 forks source link

stat is slow #88

Closed milahu closed 1 month ago

milahu commented 1 month ago

stat is about 100 times slower than readdir

wget https://annas-archive.org/dyn/small_file/torrents/managed_by_aa/zlib/pilimi-zlib-12160000-12229999.torrent
mkdir mount_dir
btfs pilimi-zlib-12160000-12229999.torrent mount_dir
sleep 5 # wait for init

time ls mount_dir/pilimi-zlib-12160000-12229999 | wc -l
# 61189
# real    0m0.549s

time find mount_dir/pilimi-zlib-12160000-12229999/ -type f | wc -l
# 61189
# real    0m46.828s

compare

mkdir /run/user/$UID/btfs_test
cd /run/user/$UID/btfs_test
seq 61189 | xargs touch

time ls | wc -l
# 61189
# real    0m0.541s

time find . -type f | wc -l
# 61189
# real    0m0.152s

example torrent from annas-archive.org

johang commented 1 month ago

Doesn't really surprise me. FUSE has a lot of overhead and is not meant to be used for high performance applications.