-
Notifications
You must be signed in to change notification settings - Fork 419
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
Improve speed for windows Get-CimInstance
#1053
Conversation
This only fetches a single property which is faster
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.
Thanks.
Do you have any measurements before & after?
Yeah, sure. My bad, I should have lead with that: On my machine the old command takes about 1s, this new one only about 0.2s. I've measured this inside powershell by wrapping the expressions inside |
Could you also measure Yeah 1s seems a lot, I'll try to do a release with this improvement soon. |
Unfortunately the |
I wonder, is powershell available on all Windows machines? |
FWIW I left a comment on https://bugs.ruby-lang.org/issues/20309#note-22, making win32ole a bundled gem seems to cause more harm than help (in performance & portability). |
Well, the speed regression is my fault, I just wasn't careful enough. As for if powershell will be available, I would say you can rely on this as much as The features available of this gem go far beyond just querying wmi, like interacting with excel/word, or other modern software like internet explorer. Basically a full-on automation interface. If you look at the gem itself, the C code to pipe that all through to ruby is quite extensive. |
In that sense it was more like using a canon to kill a fly. It is sad that |
To clarify I didn't mean to criticize what you did, the opposite, it is much appreciated :) |
This is a small followup for #1051.
In terms of the previous code, the powershell invocation currently does
select * from Win32_Processor
which is slower. I missed this in the other PR, this improves the speed when detection runs on windows.The pipe is still needed since that command returns all properties anyways, they are just empty/not computed.