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

Re: large files and low memory

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 4, 2010, 18:58 UTC
Message-ID
<20101004185854.GA6466@burratino>
In-Reply-To
<AANLkTimbdrAqoWMxiteT5zNYmwHp8M698BEv1FLuiAxx@mail.gmail.com>
Shawn Pearce wrote:
> The mmap() isn't the problem.  Its the allocation of a buffer that is
> larger than the file in order to hold the result of deflating the file
> before it gets written to disk.
Wasn't this already fixed, at least in some cases?
commit 9892bebafe0865d8f4f3f18d60a1cfa2d1447cd7 (tags/v1.7.0.2~11^2~1)
Author: Nicolas Pitre <nico@fluxnic.net>
Date:   Sat Feb 20 23:27:31 2010 -0500
    sha1_file: don't malloc the whole compressed result when writing out objects
    There is no real advantage to malloc the whole output buffer and
    deflate the data in a single pass when writing loose objects. That is
    like only 1% faster while using more memory, especially with large
    files where memory usage is far more. It is best to deflate and write
    the data out in small chunks reusing the same memory instead.
    For example, using 'git add' on a few large files averaging 40 MB ...
    Before:
    21.45user 1.10system 0:22.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+828040outputs (0major+142640minor)pagefaults 0swaps
    After:
    21.50user 1.25system 0:22.76elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+828040outputs (0major+104408minor)pagefaults 0swaps
    While the runtime stayed relatively the same, the number of minor page
    faults went down significantly.
    Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previous: Nicolas PitreNext: Shawn Pearce
Message 15 of 29 in “large files and low memory”
  1. Enrico WeigeltOct 4, 2010
  2. Shawn PearceOct 4, 2010
  3. Joshua JensenOct 4, 2010
  4. Shawn PearceOct 4, 2010
  5. Enrico WeigeltOct 5, 2010
  6. Enrico WeigeltOct 5, 2010
  7. Matthieu MoyOct 5, 2010
  8. Enrico WeigeltOct 5, 2010
  9. Alex RiesenOct 5, 2010
  10. Matthieu MoyOct 5, 2010
  11. Nguyen Thai Ngoc DuyOct 5, 2010
  12. Junio C HamanoOct 5, 2010
  13. Nguyen Thai Ngoc DuyOct 5, 2010
  14. Nicolas PitreOct 5, 2010
  15. Jonathan NiederOct 4, 2010
  16. Shawn PearceOct 4, 2010
  17. Jonathan NiederOct 4, 2010
  18. Nguyen Thai Ngoc DuyOct 5, 2010
  19. Nicolas PitreOct 5, 2010
  20. Jonathan NiederOct 5, 2010
  21. Nicolas PitreOct 5, 2010
  22. Enrico WeigeltOct 5, 2010
  23. Ævar Arnfjörð BjarmasonOct 5, 2010
  24. Jonathan NiederOct 5, 2010
  25. Enrico WeigeltOct 5, 2010
  26. Jonathan NiederOct 5, 2010
  27. Enrico WeigeltOct 5, 2010
  28. Nicolas PitreOct 5, 2010
  29. Enrico WeigeltOct 5, 2010

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.