Skip to content

Avoid PowerShell startup for Windows parent command queries - #918

Merged
sds merged 1 commit into
mainfrom
perf/native-windows-parent-query
Nov 5, 2026
Merged

sds merged 1 commit into
mainfrom
perf/native-windows-parent-query

Conversation

@sds

@sds sds commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Windows currently launches PowerShell whenever a hook inspects its parent command. Use Ruby's COM support to query the same WMI CommandLine field directly when win32ole is available, and retain the existing PowerShell implementation when the library is missing or COM access fails. This adds no dependency; Ruby versions without win32ole keep the fallback.

Five paired GitHub Windows measurements on the production-sized shards all improved: 10.3% median and 8.9% aggregate test-command reduction, with positive results in both control/candidate execution orders. The slowest sampled shard fell from 51.8s to 46.2s. Benchmark run.

Validation: existing examples retained; added coverage for complete Unicode command lines, exited/inaccessible processes, denied COM access, and missing win32ole. Local utility specs and RuboCop pass. Full Ruby 3.3/3.4/4.0 × Ubuntu/Windows CI is required before merging.

Final verification: full GitHub CI passed in 1m43s, with all 1,703 examples executed exactly once for each of the six Ruby/OS combinations (10,218 executions). Aggregate coverage increased to 92.425%, +0.02 percentage points. Optional partial-shard coverage comparisons changed when the five new examples redistributed later examples; required CI/lint and every matrix job passed.

@sds
sds merged commit 692604b into main Nov 5, 2026
31 of 38 checks passed
@sds
sds deleted the perf/native-windows-parent-query branch November 5, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant