git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-p4import.py robustness changes

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 4, 2007, 05:54 UTC
Message-ID
<20070604055433.GD4507@spearce.org>
In-Reply-To
<839AEF71-ED29-4A79-BE97-C79EAFEDC466@slamb.org>
Scott Lamb <slamb@slamb.org> wrote:
Show 9 quoted lines
> On Jun 3, 2007, at 6:11 AM, Simon Hausmann wrote:
> >On the topic of git integration with perforce, what are the chances  
> >of getting
> >git-p4 ( http://repo.or.cz/w/fast-export.git ) into git's contrib/ 
> >fast-export
> >area? :)
> 
> I missed that one...I just saw Tailor and the Perl script someone  
> else had written.
Perhaps why it should be in contrib/fast-import?  ;-)
 
Show 13 quoted lines
> As for performance...hmm. Looks like git-p4import.py runs these  
> commands for each Perforce revision:
> 
>     realtime  operation
>         3.4%  p4 describe -s N
>        66.6%  p4 sync ...@N
>    [*] 10.2%  git ls-files -m -d -o -z | git update-index --add -- 
> remove -z --stdin
>         2.6%  git rev-parse --verify HEAD
>         4.2%  git write-tree
>         2.8%  git commit-tree xxxxxx
>         7.5%  git tag -f p4/N xxxxxx
>         2.7%  git update-ref HEAD xxxxxx
...
> git-p4 seems to use "git fast-import". I guess the big performance  
> improvement there is removing the ls-files operation? So we're  
> talking about a 0-10% speedup, right? Plus some fork()/exec() overhead.

fast-import folds all of the git commands you list above behind a single engine that is *fast*. So its actually a 0-30% gain that is available by using the fast-import backend, with a single fork()/exec() for the *entire import*. The local object IO performed by Git is also minimized, so large imports have much better IO behavior from the Git perspective. Its not something to sneeze at.

fast-import also can run in parallel with the frontend process, allowing you to use a dual-core system, to the extent that your disk(s) and network can keep up. Generally p4 is going to be the bottleneck.

I think writing data to fast-import is much easier than running the raw Git commands, especially when you are talking about an import engine where you need to set all of the special environment variables for git-commit-tree or git-tag to do its job properly. Its a good tool that simply doesn't get enough use, partly because nobody is using it...

-- 
Shawn.
Previous: Scott LambNext: Dana How
Message 9 of 26 in “git-p4import.py robustness changes”
  1. Scott LambMay 31, 2007
  2. Junio C HamanoMay 31, 2007
  3. Scott LambJun 2, 2007
  4. Junio C HamanoJun 2, 2007
  5. Scott LambJun 2, 2007
  6. Junio C HamanoJun 2, 2007
  7. Simon HausmannJun 3, 2007
  8. Scott LambJun 3, 2007
  9. Shawn O. PearceJun 4, 2007
  10. Dana HowJun 4, 2007
  11. Shawn O. PearceJun 4, 2007
  12. Scott LambJun 4, 2007
  13. Simon HausmannJun 5, 2007
  14. Marius Storm-OlsenJun 4, 2007
  15. Shawn O. PearceJun 4, 2007
  16. Simon HausmannJun 12, 2007
  17. Scott LambJun 13, 2007
  18. Simon HausmannJun 13, 2007
  19. Shawn O. PearceJun 14, 2007
  20. Simon HausmannJun 14, 2007
  21. Shawn O. PearceJun 15, 2007
  22. Marius Storm-OlsenJun 15, 2007
  23. 1/4 git-p4import: fix subcommand error handlingScott Lamb, Jun 3, 2007
  24. 2/4 git-p4import: use lists of subcommand argumentsScott Lamb, Jun 3, 2007
  25. 3/4 git-p4import: resume on correct p4 changesetScott Lamb, Jun 3, 2007
  26. 4/4 git-p4import: partial historyScott Lamb, Jun 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.