Skip to content

ls: Reduce xattr calls#11421

Open
kimono-koans wants to merge 9 commits intouutils:mainfrom
kimono-koans:excessive_xattr_calls
Open

ls: Reduce xattr calls#11421
kimono-koans wants to merge 9 commits intouutils:mainfrom
kimono-koans:excessive_xattr_calls

Conversation

@kimono-koans
Copy link
Contributor

@kimono-koans kimono-koans commented Mar 19, 2026

Master calls listxattr more times than necessary:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ------------------
 17.83    0.000783         783         1           execve
 15.87    0.000697          15        44           getdents64
 11.82    0.000519           6        84           listxattr
 10.00    0.000439           8        53         6 statx
  8.72    0.000383          12        31         1 openat
  6.67    0.000293          22        13           mmap
  5.05    0.000222           6        34           close
  4.94    0.000217          19        11           read
  4.19    0.000184           6        30           fstat
  1.73    0.000076          15         5           mprotect
  1.53    0.000067          33         2           munmap
  1.46    0.000064          16         4         4 connect
  1.30    0.000057           9         6           brk
  1.09    0.000048          12         4           socket
  1.07    0.000047          47         1           write
  0.89    0.000039           7         5           ioctl
  0.82    0.000036           9         4           newfstatat
  0.77    0.000034           3         9           rt_sigaction
  0.59    0.000026          26         1           set_robust_list
  0.48    0.000021          10         2           pread64
  0.46    0.000020           6         3           fcntl
  0.43    0.000019          19         1         1 access
  0.32    0.000014           7         2           prlimit64
  0.30    0.000013          13         1           poll
  0.30    0.000013           1         9         6 readlink
  0.27    0.000012           4         3           sigaltstack
  0.23    0.000010           3         3           lseek
  0.23    0.000010          10         1           getrandom
  0.20    0.000009           9         1           sched_getaffinity
  0.16    0.000007           7         1           arch_prctl
  0.16    0.000007           7         1           set_tid_address
  0.14    0.000006           6         1           rseq
  0.00    0.000000           0         1           gettid
------ ----------- ----------- --------- --------- ------------------
100.00    0.004392          11       372        18 total

This PR reduces those calls:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ------------------
 19.28    0.000822         822         1           execve
 11.75    0.000501          11        42           llistxattr
  8.66    0.000369           8        44           getdents64
  8.02    0.000342           6        53         6 statx
  7.62    0.000325          10        31         1 openat
  7.55    0.000322          24        13           mmap
  5.98    0.000255          51         5           mprotect
  4.60    0.000196          17        11           read
  4.41    0.000188           5        34           close
  4.03    0.000172           5        30           fstat
  2.63    0.000112          12         9         6 readlink
  2.42    0.000103          25         4         4 connect
  2.18    0.000093          23         4           socket
  1.81    0.000077          12         6           brk
  1.55    0.000066          33         2           munmap
  1.31    0.000056           6         9           rt_sigaction
  0.89    0.000038          38         1           write
  0.84    0.000036           9         4           newfstatat
  0.61    0.000026          13         2           pread64
  0.47    0.000020           6         3           fcntl
  0.42    0.000018          18         1         1 access
  0.38    0.000016           5         3           sigaltstack
  0.35    0.000015           7         2           prlimit64
  0.30    0.000013          13         1           poll
  0.30    0.000013           4         3           lseek
  0.28    0.000012           2         5           ioctl
  0.23    0.000010          10         1           sched_getaffinity
  0.21    0.000009           9         1           arch_prctl
  0.21    0.000009           9         1           getrandom
  0.19    0.000008           8         1           set_tid_address
  0.19    0.000008           8         1           rseq
  0.16    0.000007           7         1           set_robust_list
  0.14    0.000006           6         1           gettid
------ ----------- ----------- --------- --------- ------------------
100.00    0.004263          12       330        18 total

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 19, 2026

Merging this PR will degrade performance by 11.27%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 5 regressed benchmarks
✅ 293 untouched benchmarks
⏩ 48 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation ls_recursive_wide_tree[(10000, 1000)] 53.9 ms 58 ms -7.03%
Simulation ls_recursive_long_all_wide_tree[(15000, 1500)] 136 ms 144.9 ms -6.1%
Simulation ls_recursive_balanced_tree[(6, 4, 15)] 57 ms 59 ms -3.5%
Memory ls_recursive_long_all_wide_tree[(15000, 1500)] 9.9 MB 11.2 MB -11.27%
Memory ls_recursive_wide_tree[(10000, 1000)] 6.6 MB 7.5 MB -11.25%

Comparing kimono-koans:excessive_xattr_calls (e4ba520) with main (7369f4d)

Open in CodSpeed

Footnotes

  1. 48 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@kimono-koans kimono-koans changed the title No need to request all xattrs when one needs one specific xattr ls: Reduce xattr calls Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant