htop
htop copied to clipboard
Perf
-
Annotate mbstowcs_nonfatal() with restrict
The arguments to our mbrtowc(3) wrapper should not alias, since they also must not for mbrtowc(3).
Might help some compilers optimizing the code.
-
Linux: use fast integer parsing for /proc/
/stat /proc/
/stat is parsed for every displayed process on every iteration containing several numbers to parse. Use out own implementations since strto(u)l(3) came up during profiling. @BenBE what was the reason for adding the parameter
maxlento those functions?
The reason for the maxlen argument had mostly two aspects:
- Defense in depth regarding avoiding buffer overruns
- Unless the input is all zero, every string above a certain length will overflow.
@cgzones Do you mind updating this PR?