Commit 1464bec
committed
perf: cache username syscalls, precompute filter paths, eliminate hot-loop allocations
- Cache username via OnceCell on Process (syscall runs once per instance)
- Precompute slash-suffixed file/dir paths in Filter at construction
- Fix filter exclusion loop to call username() once, not per-excluded-name
- FD name comparison: parse filter string to int instead of int to string
- Precompute parsed IpAddr for host matching (structural equality vs to_string)
- FdName::as_display returns Cow<str> (zero-alloc for static variants)
- Add Process::new() constructor, keep username_cache private1 parent 884cf28 commit 1464bec
19 files changed
Lines changed: 221 additions & 300 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 49 | + | |
59 | 50 | | |
60 | 51 | | |
61 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
968 | 968 | | |
969 | 969 | | |
970 | 970 | | |
971 | | - | |
| 971 | + | |
972 | 972 | | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
977 | 977 | | |
978 | | - | |
979 | | - | |
980 | | - | |
| 978 | + | |
981 | 979 | | |
982 | 980 | | |
983 | 981 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
| 153 | + | |
156 | 154 | | |
157 | 155 | | |
158 | 156 | | |
| |||
514 | 512 | | |
515 | 513 | | |
516 | 514 | | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
| 515 | + | |
527 | 516 | | |
528 | 517 | | |
529 | 518 | | |
| |||
0 commit comments