eza-community / eza-community/eza

feat: reduce amount of syscalls

Open
#558 5 comments 6 reactions 0 assignees View on GitHub
area: performance type: feature
Dominant language
Rust
Stars
23.3k
Forks
523
PR merge metrics
No merged PRs in 30d

Description

eza version `v0.14.1 [+git]`

## `eza` syscall trace
![Screenshot_20231023_193401](https://github.com/eza-community/eza/assets/63464137/efe49915-cb38-43ce-83c7-9af1f0a34a19)


## `ls` syscall trace
![Screenshot_20231023_193418](https://github.com/eza-community/eza/assets/63464137/c2aed101-2a2d-4642-982b-5e38193891fc)


## Info
The folder `./target/debug/deps/` ( example folder , any folder with large number of files ) contains `677` files. ( all numbers based on this folder ).
I tested `multiple` times to `come to this`.


## readlink
`eza` makes `2708` `readlink` syscalls, which all fail. This syscall takes around `50-60%` of the execution time. "ls" checks whether a file is a symbolic link before calling `readlink`, while "eza" does not perform this check. (`ls` as `0` calls)


## getcwd
`eza` calls the `getcwd` syscall `677` times, for every file instead of caching it. (`ls` as `0` calls)


## statx
`eza` calls the `statx` syscall `678` times ,even when it does not need the file stats, which unnecessary.
It is not printing, then why call ? (`ls` as `0` calls)


## write
`eza` writes file individually, without using any buffering


# Summary
`ls` takes `72` syscall and `0.000422` seconds.
`eza` needs `4903` syscall and `0.029659` seconds.


`readlink` , `getcwd` , `statx`, `write` takes around `4700` syscall.

## `eza` takes `70` times more `syscalls` and `time`

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; first reproduce the syscall trace against a directory such as target/debug/deps and compare eza with ls. Trace the file traversal, metadata, symlink, working-directory, and output paths, then validate that unnecessary calls are reduced without changing CLI behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.