| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
It's going to take a bit of time to review all the changes. Staffan Gustafsson (@powercode) did you test your changes remotely with WMI and CIM instances?
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT) To be honest, I've done an embarrassingly small amount of testing. Except for running Start-PSPester. |
Sorry, something went wrong.
|
Note to reviewers: Bruce Payette (@BrucePay) Dongbo Wang (@daxian-dbw) I tried another route in this second PR, by adding another delegate for member lookup. It is less intrusive in the previous functionality, so the risk should be lower. I have refactored PSObject to use flags instead of Booleans. I also removed some unused fields, and have plans for using the available padding for speeding up the handling of the remoting properties. I added a field for the stream to use by the formatting system - this was previously magically named PSNoteProperties - and the lookup of these was expensive during formatting. As you can see, I've implemented a special case of a the Linq operator FirstOrDefault, but I chose not to make this an iterator as I wanted to keep allocations to a minimum. Not sure it's the right call, just trying to explain where I come from :) I'm a bit weak on the serialization, so that is an area that could need some scrutiny to see if I've messed anything up. |
Sorry, something went wrong.
It can break remoting/serialization and backward compatibility. |
Sorry, something went wrong.
I think that is just an implementation detail. We may need to handle that in the deserializer - but good to keep in mind when doing it. |
Sorry, something went wrong.
|
I have a sample implementation here - https://github.com/powercode/PowerShell/tree/PSObjectFlags Edit: |
Sorry, something went wrong.
Looks great at first short review! (We'll need measurement of CPU/memory benefits. And main complicity is that we have to manually test remoting and serialization.) |
Sorry, something went wrong.
Cleaning up PSObject, making the bools into flag fields, leaving room for using the remaing padding for additional flags.
|
Ilya (@iSazonov) Steve Lee (@SteveL-MSFT) Any chance we can turn of the hungarian notation warnings from Code Factor? It has nearly 100% false positives. I don't intend to fix the remaining code factor issues. |
Sorry, something went wrong.
|
Staffan Gustafsson (@powercode) I believe we're eventually moving off CodeFactor and over to Codacy. Agree the false positives on hungarian are annoying. |
Sorry, something went wrong.
|
Codacy reports tons of false-positives. We need to merge Dongbo's PR that resolve most CodeFactor issues. |
Sorry, something went wrong.
There was a problem hiding this comment.
A lot of this is way out of my depth, but I hope some of this is helpful! 😊
Nothing serious, mostly nitpicks.
Sorry, something went wrong.
|
Rain Sallow (/u/ta11ow) (@vexx32) I don't look but if you comments is for copy-pasted (not new) code we shouldn't fix it in the PR - it is complicate code review. |
Sorry, something went wrong.
|
Looks good! |
Sorry, something went wrong.
|
It seems we need rename the PR from
to
|
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. Now we need to add tests.
We can add xUnit tests to exercise PSObject.GetFirstPropertyOrDefault.
Add [Feature] tag to the last commit to kick off the feature tests on Linux and macOS.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
Can we move style changes to #9149 to follow our best practice? |
Sorry, something went wrong.
|
Ilya (@iSazonov) I have reviewed all changes in this PR and all look good. Separating the refactoring changes will not only cost extra efforts to resolve conflicts but also require another pass of review to make sure no mistake made during those changes. I don't think it worth the effort. |
Sorry, something went wrong.
|
All issues reported by Codacy are false alarms. |
Sorry, something went wrong.
We agreed to write this in our guide. This allows us to maintain a clear history of functional changes without style ones. Of course it takes effort. |
Sorry, something went wrong.
I agree that will get us a clear view of the functional change history. But I think it's more appropriate to bring this up at very early stage of the PR life cycle. |
Sorry, something went wrong.
At early stage we haven't all style changes. The main benefit is that the commits are clean.
In previous powercode's PR you did this :-) |
Sorry, something went wrong.
|
Staffan Gustafsson (@powercode) Thanks for the great improvement! |
Sorry, something went wrong.
|
Staffan Gustafsson (@powercode) This is outstanding work here! |
Sorry, something went wrong.
…ct` (PowerShell#8785) By not doing excessive amounts of extra work, formatting can be sped up quite significantly (about 8x faster). The main change comes from adding new, more efficient, primitive to query an object for the existence of an instance member. The formatting system has been checking for if an object has properties other than some decorated properties added by PS remoting, and it doesn't this by retrieving all properties which results in heavy allocations and wasted cycles. By adding `GetFirstOrDefault` to `PSObject` and similar primitives to the underlying Adapters, we are able to return early, without having to get all properties back.
| Back | FazBrowse Home | New Git URL |
By not doing excessive amounts of extra work, formatting can be sped up quite significantly.
The main change comes from adding new, more efficient, primitive to query an object for the existence of an instance member.
The formatting system has been checking for if an object has properties other than some decorated properties added by PS remoting, and it doesn't this by retrieving all properties which results in heavy allocations and wasted cycles.
By adding GetFirstOrDefault to PSObject and similar primitives to the underlying Adapters, we are able to return early, without having to get all properties back.
Test script:
PR Summary
PR Context
PR Checklist