Skip to content

Conversation

@powercode
Copy link
Collaborator

@powercode powercode commented Aug 31, 2018

PR Summary

By not tracking context in the common case where Context size is 0, and by not checking if the full name of a FileInfo is a Directory, about 30% of the execution time is cut when piping files into Select-String.

PR Checklist

Copy link
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
But shouldn't this also use the NoContextTracker?

_globalContextTracker = new ContextTracker(_preContext, _postContext);

@powercode
Copy link
Collaborator Author

@PaulHigin You are right!

@adityapatwardhan
Copy link
Member

@powercode Please address the CodeFactor issues, specifically in new code.

@powercode
Copy link
Collaborator Author

@adityapatwardhan Do you want me to fix all it the file or just the new ones? Happy to do both, but more to review if I fix all of them.

@adityapatwardhan
Copy link
Member

@powercode Fixing the CodeFactor issues for the code you added / changed should be sufficient. Thanks!

Don't check if fileinfos are directories (they never are).
Don't track context when context size is 0.
Copy link
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

return s_inputStream;
return _path;
}
get => !_pathSet ? s_inputStream : _path;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More readable:

get => _pathSet ? _path : s_inputStream; 

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure - don't know what I was thinking :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

{
throw PSTraceSource.NewArgumentNullException("value");
}
_includeStrings = value ?? throw PSTraceSource.NewArgumentNullException("value");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use nameof(value).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@iSazonov
Copy link
Collaborator

@powercode Please address comments and we'll merge.

@powercode
Copy link
Collaborator Author

@iSazonov I'll have a look this evening.

Copy link
Collaborator

@iSazonov iSazonov Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the remove - we can not change a public contract.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change to comment to indicated that this isn't used anywhere?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't block the PR and please open new tracking Issue to get PowerShell Committee conclusion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I force-pushed the revert of the Filename property.

Also removing the non-referenced property FileName.
@iSazonov iSazonov merged commit 9c4340a into PowerShell:master Oct 18, 2018
@iSazonov
Copy link
Collaborator

@powercode Thanks for great work!

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.

4 participants