Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
below: read_all_pids: Use byte iteration for pid walking
Summary: core::str::pattern::CharSearcher::next_match is very expensive (~2.5% CPU instructions per iteration). This can be made much more efficient by using byte iteration, and by avoiding having to check whether this is a pid dir twice. This is more efficient for a few reasons: 1. We do not require a check that the filename is valid UTF-8 2. We do not require allocations (as .to_string_lossy() may) 3. We now avoid doing the work twice Rudimentary testing with a small pid hierarchy shows around a 0.5% to 1% reduction in CPU instructions per iteration. Reviewed By: lnyng Differential Revision: D58193111 fbshipit-source-id: cba2b6f72995fe38e0ba4e055e884c069392c01e
- Loading branch information