-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Processes() calls with many cores #1514
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit a7a9498.
shirou
reviewed
Aug 27, 2023
atoulme
force-pushed
the
faster_file_read
branch
from
August 27, 2023 16:59
dff21d1
to
ae119d3
Compare
This reverts commit ae119d3.
Could you check and run benchmark #1515 ? |
shirou
approved these changes
Aug 29, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested on AWS c5a.16xlarge (CPU=64), and I got this result. It seems definite improvement. Thank you for your contribution!
goos: linux
goarch: amd64
pkg: github.com/shirou/gopsutil/v3/process
cpu: AMD EPYC 7R32
│ base.txt │ after.txt │
│ sec/op │ sec/op vs base │
Processes-64 37.35m ± 1% 34.81m ± 1% -6.79% (p=0.000 n=10)
│ base.txt │ after.txt │
│ B/op │ B/op vs base │
Processes-64 9.250Mi ± 0% 7.009Mi ± 0% -24.22% (p=0.000 n=10)
│ base.txt │ after.txt │
│ allocs/op │ allocs/op vs base │
Processes-64 64.57k ± 0% 57.64k ± 0% -10.73% (p=0.000 n=10)
(Memo: I have tested use ReadBytes
instead of ReadString
, but nothing changed)
dave-gray101
referenced
this pull request
in mudler/LocalAI
Sep 1, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/shirou/gopsutil/v3](https://togithub.com/shirou/gopsutil) | require | patch | `v3.23.7` -> `v3.23.8` | --- ### Release Notes <details> <summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary> ### [`v3.23.8`](https://togithub.com/shirou/gopsutil/releases/tag/v3.23.8) [Compare Source](https://togithub.com/shirou/gopsutil/compare/v3.23.7...v3.23.8) <!-- Release notes generated using configuration in .github/release.yml at v3.23.8 --> #### What's Changed [#​1514](https://togithub.com/shirou/gopsutil/issues/1514) improves `Processes()` performance 6% or more. Thank you [@​atoulme](https://togithub.com/atoulme) ! ##### cpu - Enable setting of vendor and related information for all Power versions by [@​kishen-v](https://togithub.com/kishen-v) in [https://github.com/shirou/gopsutil/pull/1495](https://togithub.com/shirou/gopsutil/pull/1495) - chore: change CIRCLECI environment variable to CI. by [@​shirou](https://togithub.com/shirou) in [https://github.com/shirou/gopsutil/pull/1518](https://togithub.com/shirou/gopsutil/pull/1518) ##### disk - fix: fixed windows disk package leaks by [@​ozanh](https://togithub.com/ozanh) in [https://github.com/shirou/gopsutil/pull/1501](https://togithub.com/shirou/gopsutil/pull/1501) - fix IOCounters() SerialNumber enumeration by [@​gdvalle](https://togithub.com/gdvalle) in [https://github.com/shirou/gopsutil/pull/1508](https://togithub.com/shirou/gopsutil/pull/1508) ##### host - \[host]\[linux]: remove double quote from lsb release info by [@​shirou](https://togithub.com/shirou) in [https://github.com/shirou/gopsutil/pull/1504](https://togithub.com/shirou/gopsutil/pull/1504) ##### mem - mem: linux: fix vmstat field names by [@​chouquette](https://togithub.com/chouquette) in [https://github.com/shirou/gopsutil/pull/1498](https://togithub.com/shirou/gopsutil/pull/1498) ##### process - Fix Processes() calls with many cores by [@​atoulme](https://togithub.com/atoulme) in [https://github.com/shirou/gopsutil/pull/1514](https://togithub.com/shirou/gopsutil/pull/1514) #### New Contributors - [@​kishen-v](https://togithub.com/kishen-v) made their first contribution in [https://github.com/shirou/gopsutil/pull/1495](https://togithub.com/shirou/gopsutil/pull/1495) - [@​chouquette](https://togithub.com/chouquette) made their first contribution in [https://github.com/shirou/gopsutil/pull/1498](https://togithub.com/shirou/gopsutil/pull/1498) - [@​ozanh](https://togithub.com/ozanh) made their first contribution in [https://github.com/shirou/gopsutil/pull/1501](https://togithub.com/shirou/gopsutil/pull/1501) - [@​gdvalle](https://togithub.com/gdvalle) made their first contribution in [https://github.com/shirou/gopsutil/pull/1508](https://togithub.com/shirou/gopsutil/pull/1508) **Full Changelog**: shirou/gopsutil@v3.23.7...v3.23.8 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/go-skynet/LocalAI). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi42OC4xIiwidXBkYXRlZEluVmVyIjoiMzYuNjguMSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @shirou,
This is reprisal of the work of #1497. Given that we're not to touch the interfaces of gopsutil and cannot touch the mechanism by which we capture boot time, I have ventured to make boot time faster by making the /proc/stat file read more efficient.
Here are the details of the implementation, tested on an Ampere developer platform with 80 cores (the number of cores is particularly impactful as it makes /proc/stat longer to read).
on branch master:
on branch read_file_faster:
Benchstat output across all benchmarks of the process package:
Typical /proc/stat file: