Dominik,

While researching a git stash question on Stack Overflow 
<http://stackoverflow.com/questions/23433637/git-stash-avoid-on-branch-name-string-in-message/24196203>,
 
I learned that git stash is implemented as a shell script. Dig around in 
the GIT_EXEC_PATH (type git --exec-path to get this path), and locate 
git-stash.

Being a shell script has to be part of the reason why it's slower. Below is 
the TRACE output git stash:

% GIT_TRACE=1 git stash
trace: exec: 'git-stash'
trace: run_command: 'git-stash'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'config' '--get-colorbool' 'color.interactive'
trace: built-in: git 'config' '--get-color' 'color.interactive.help' 'red 
bold'
trace: built-in: git 'config' '--get-color' '' 'reset'
trace: built-in: git 'update-index' '-q' '--refresh'
trace: built-in: git 'diff-index' '--quiet' '--cached' 'HEAD' 
'--ignore-submodules' '--'
trace: built-in: git 'update-index' '-q' '--refresh'
trace: built-in: git 'diff-index' '--quiet' '--cached' 'HEAD' 
'--ignore-submodules' '--'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'rev-list' '--oneline' '-n' '1' 'HEAD' '--'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'write-tree'
trace: built-in: git 'commit-tree' 
'db702d6700ab1f5f8ff72d5ca67ccbacb80be2ad' '-p' 
'c8fff4c53ab78507c702a404f289d25e18f44614'
trace: built-in: git 'read-tree' 
'--index-output=/home/rick/math2/.git/index.stash.8180' '-m' 
'db702d6700ab1f5f8ff72d5ca67ccbacb80be2ad'
trace: built-in: git 'diff' '--name-only' '-z' 'HEAD' '--'
trace: built-in: git 'update-index' '-z' '--add' '--remove' '--stdin'
trace: built-in: git 'write-tree'
trace: built-in: git 'commit-tree' 
'db702d6700ab1f5f8ff72d5ca67ccbacb80be2ad' '-p' 
'c8fff4c53ab78507c702a404f289d25e18f44614' '-p' 
'c7c81a46d738539ee5f913cd9830b5d735788b6f'
trace: built-in: git 'update-ref' '-m' 'WIP on new_stuff: c8fff4c ' 
'refs/stash' '147be634d72247240847ed7aadc8de6519489bec'
Saved working directory and index state WIP on new_stuff: c8fff4c
trace: built-in: git 'reset' '--hard'
HEAD is now at c8fff4c 

Below is the trace of the same file using git commit.

GIT_TRACE=1 git commit -m "You know."
trace: built-in: git 'commit' '-m' 'You know.'
[new_stuff cce5fd5] You know.
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 ba

Given the above, you should see that the stash is stored as a commit, but 
in a separate "ref" ("refs/stash").

Peace!

On Monday, July 7, 2014 2:59:18 AM UTC-4, Dominik Rauch wrote:
>
> Hi!
>
> Why is the git stash command three times slower than the git commit 
> command? We've found that out just recently in some performance tests and 
> have wondered what's the huge underlying difference between the commands? 
> Isn't it just like a commit on a "temporary" branch?
>
> Best regards,
> Dominik Rauch
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to