Add options to speed it way up by reducing qx() calls#2
Open
cxw42 wants to merge 6 commits intomackyle:masterfrom
Open
Add options to speed it way up by reducing qx() calls#2cxw42 wants to merge 6 commits intomackyle:masterfrom
cxw42 wants to merge 6 commits intomackyle:masterfrom
Conversation
added 6 commits
April 7, 2019 11:44
This is to make it easier for others to contribute.
This way you can skip the call to `git var GIT_PAGER` if the user has set `--pager` in `log-compact.defaults`.
This option, when specified, means we don't have to run `git config --get-color`, which greatly reduces the time spent in qx() (aka CORE:backtick in Devel::NYTProf). - Added command-line option - Added a copy of Term::ANSIColor::Simple, which has compatible licensing - Updated the copy to remove implicit reset (`ESC [0m`) and add an explicit reset sub Also: - Updated the copyright notice to include "and contributors" - Added a contributors list to the README
It was checking whether we were in a git repo. However, the open() call to open `git log` also tells us that, so the rev-parse check was redundant. The only other `git` call before the `git log` is a `git --exec-path`, which doesn't care whether or not we're in a repo. I also added some comments to mark major parts of the script.
This variable, if it exists, is used instead of `log-compact.defaults`. This speeds up git-log-compact, since it eliminates a `git config` call.
Also removed the `use` statements for Exporter and overload, which reduces compilation time.
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.
Kyle, thanks for this tool, which I have been using for a year or two now with great success! Today I was trying out the Devel::NYTProf profiler on
git-log-compactand noticed that most of the time went intoqx()calls. I investigated, and found that most of them were calls togit config.This PR has several commits, each of which permits replacing a
qx(git config ...)call with a command-line parameter or default. On a test repo I have with about twenty commits, the time to rungit-log-compactdropped from about one second to about 200 ms with these changes.The last commit also adds an environment variable that can be used to hold the defaults, so you don't even have to call
git configto get those!Please let me know if you have any questions or comments. Thank you very much for considering this PR!
Chris (cpan: CXW)