You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/uu/ls/BENCHMARKING.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,13 @@
1
1
# Benchmarking ls
2
2
3
3
ls majorly involves fetching a lot of details (depending upon what details are requested, eg. time/date, inode details, etc) for each path using system calls. Ideally, any system call should be done only once for each of the paths - not adhering to this principle leads to a lot of system call overhead multiplying and bubbling up, especially for recursive ls, therefore it is important to always benchmark multiple scenarios.
4
+
5
+
ls _also_ prints a lot of information, so optimizing formatting operations is also critical:
6
+
- Try to avoid using `format` unless required.
7
+
- Try to avoid repeated string copies unless necessary.
8
+
- If a temporary buffer is required, try to allocate a reasonable capacity to start with to avoid repeated reallocations.
9
+
- Some values might be expensive to compute (e.g. current line width), but are only required in some cases. Consider delaying computations, e.g. by wrapping the evaluation in a LazyCell.
10
+
4
11
This is an overview over what was benchmarked, and if you make changes to `ls`, you are encouraged to check
5
12
how performance was affected for the workloads listed below. Feel free to add other workloads to the
6
13
list that we should improve / make sure not to regress.
0 commit comments