Lsr: ls but with io_uring

I applied some of my io_uring learnings to writing an implementation of ls(1) with the goal of minimizing syscalls. The repo is here, and I did a little writeup here. I was mostly interested in the syscall reduction I could get in a realistic program which relies very little on traditional IO (reads, writes, etc). Nearly all the IO for something like ls are syscalls: statx to be specific. I benchmarked syscalls and time of several popular options, syscall results are below.

Program n=10 n=100 n=1,000 n=10,000
lsr -al 20 28 105 848
ls -al 405 675 3,377 30,396
eza -al 319 411 1,320 10,364
lsd -al 508 1,408 10,423 100,512
uutils ls -al 445 986 6,397 10,005

and here’s a bonus screenshot! I added some fancy icons to be like the other big guys (eza and lsd):

38 Likes

Nice! Curious, did you happen to measure latency differences?

Ah, I see it’s in the write-up. I think you can put the latency table here too, because in the end, that’s all that matters (as long as the ouput is correct) for ls. :slight_smile:

Here’s the table!

Program n=10 n=100 n=1,000 n=10,000
lsr -al 372.6 µs 634.3 µs 2.7 ms 22.1 ms
ls -al 1.4 ms 1.7 ms 4.7 ms 38.0 ms
eza -al 2.9 ms 3.3 ms 6.6 ms 40.2 ms
lsd -al 2.1 ms 3.5 ms 17.0 ms 153.4 ms
uutils ls -al 2.9 ms 3.6 ms 11.3 ms 89.6 ms
1 Like

This is BLAZINGLY FAST!!

1 Like

So fast it doesn’t even need emojis!

1 Like

:rocket::rocket::rocket::rocket::rocket::rocket::rocket::rocket::rocket::rocket::rocket::rocket:

Really cool, with alias my new ‘l’, ‘ll’. :grinning_face: