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

Re: fast-import and unique objects.

From
RARyan Anderson <ryan@michonline.com>
Date
Aug 7, 2006, 07:57 UTC
Message-ID
<20060807075744.GB15477@h4x0r5.com>
In-Reply-To
<20060806180323.GA19120@spearce.org>
On Sun, Aug 06, 2006 at 02:03:24PM -0400, Shawn Pearce wrote:
Show 7 quoted lines
> 
>   - It expects an estimated object count as its second parameter.
>     In your case this would be something around 760000.  This tells
>     it how large of an object table to allocate, with each entry
>     being 24 bytes + 1 pointer (28 or 32 bytes).  Overshooting
> 	this number will cause it to degrade by allocating one
> 	overflow entry at a time from malloc.

Hrm, you're allocating a big table and then assigning consecutive entries out of it, as pointers.

Why not just malloc a big block, and assign offsets into it, as if it were a really big array. Every time it runs out, realloc it to double the current size, and update the base pointer.

-- 
Ryan Anderson
  sometimes Pug Majere
Previous: Martin LanghoffNext: Shawn Pearce
Message 14 of 15 in “fast-import and unique objects.”
  1. Jon SmirlAug 6, 2006
  2. Jon SmirlAug 6, 2006
  3. Shawn PearceAug 6, 2006
  4. Jon SmirlAug 7, 2006
  5. Shawn PearceAug 7, 2006
  6. Jon SmirlAug 7, 2006
  7. Jakub NarebskiAug 7, 2006
  8. Jon SmirlAug 7, 2006
  9. Shawn PearceAug 8, 2006
  10. Jon SmirlAug 8, 2006
  11. Shawn PearceAug 8, 2006
  12. Jon SmirlAug 8, 2006
  13. Martin LanghoffAug 7, 2006
  14. Ryan AndersonAug 7, 2006
  15. Shawn PearceAug 7, 2006

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.