perf(battery): use GetSystemPowerStatus on Windows instead of SetupAPI/IOCTL - #7839
Merged
JanDeDobbeleer merged 1 commit intoAug 30, 2026
Conversation
📦 Release binary size reportCompares this PR's release-equivalent build against the latest published release, per OS (amd64).
|
JanDeDobbeleer
changed the base branch from
main
to
claude/lazy-load-segment-perf-8wo3t7
August 30, 2026 09:20
JanDeDobbeleer
force-pushed
the
claude/windows-battery-perf-2pc76t
branch
from
August 30, 2026 09:22
3c61f7f to
eb6a5e4
Compare
…I/IOCTL The previous implementation enumerated battery devices via SetupAPI and issued three sequential DeviceIoControl calls (IOCTL_BATTERY_QUERY_TAG, _INFORMATION, _STATUS) per battery. The STATUS query round-trips to the embedded controller, which is the dominant cost users reported (~80ms per prompt render, see #1599). GetSystemPowerStatus reads a value Windows already maintains for the taskbar battery icon, so it returns percentage and charging state without hitting the EC. The fields it can't provide (Voltage, Full/ Current capacity in mWh) aren't exposed by battery.Info today, so there's no loss of currently displayed data.
JanDeDobbeleer
force-pushed
the
claude/windows-battery-perf-2pc76t
branch
from
August 30, 2026 10:09
eb6a5e4 to
46a2569
Compare
This file contains hidden or 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
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.
The previous implementation enumerated battery devices via SetupAPI and
issued three sequential DeviceIoControl calls (IOCTL_BATTERY_QUERY_TAG,
_INFORMATION, _STATUS) per battery. The STATUS query round-trips to the
embedded controller, which is the dominant cost users reported (~80ms
per prompt render, see #1599).
GetSystemPowerStatus reads a value Windows already maintains for the
taskbar battery icon, so it returns percentage and charging state
without hitting the EC. The fields it can't provide (Voltage, Full/
Current capacity in mWh) aren't exposed by battery.Info today, so
there's no loss of currently displayed data.