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

Re: Distribution of longest common hash prefixes

From
James Cloos <cloos@jhcloos.com>
Date
Apr 3, 2007, 17:04 UTC
Message-ID
<m3r6r1jsmq.fsf@lugabout.jhcloos.org>
In-Reply-To
<86r6r2isva.fsf@blue.stonehenge.com>
>>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:

Randal> git-rev-list --objects HEAD | sort | perl -lne ' Randal> substr($_, 40) = ""; Randal> if (defined $p) { Randal> ($p ^ $_) =~ /^(\0*)/; Randal> $common = length $1; Randal> if (defined $pcommon) { Randal> $count[$pcommon > $common ? $pcommon : $common]++; Randal> } else { Randal> $count[$common]++; # first item Randal> } Randal> } Randal> $p = $_; Randal> $pcommon = $common; Randal> END { Randal> $count[$common]++; # last item Randal> print "$_: $count[$_]" for 0..$#count; Randal> } Randal> '

With that version the kernel gives:

0: 1: 2: 3: 565 4: 288450 5: 139080 6: 10699 7: 700 8: 32 9: 2

Adding in $_ = unpack("B*",pack("H*",$_)); to the script, to do the work on bits, gives:

14: 15: 565 16: 14723 17: 66765 18: 107838 19: 99124 20: 67367 21: 39238 22: 21503 23: 10972 24: 5591 25: 2927 26: 1472 27: 709 28: 382 29: 166 30: 98 31: 54 32: 20 33: 6 34: 2 35: 4 36: 37: 2

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6
Previous: Randal L. SchwartzNext: Randal L. Schwartz
Message 7 of 20 in “Distribution of longest common hash prefixes”
  1. Peter EriksenApr 2, 2007
  2. Linus TorvaldsApr 2, 2007
  3. Randal L. SchwartzApr 2, 2007
  4. Linus TorvaldsApr 2, 2007
  5. Randal L. SchwartzApr 2, 2007
  6. Randal L. SchwartzApr 2, 2007
  7. James CloosApr 3, 2007
  8. Randal L. SchwartzApr 3, 2007
  9. Shawn O. PearceApr 3, 2007
  10. Linus TorvaldsApr 3, 2007
  11. Junio C HamanoApr 3, 2007
  12. Linus TorvaldsApr 3, 2007
  13. Nicolas PitreApr 3, 2007
  14. Junio C HamanoApr 3, 2007
  15. Nicolas PitreApr 3, 2007
  16. Olivier GalibertApr 3, 2007
  17. Linus TorvaldsApr 3, 2007
  18. James CloosApr 4, 2007
  19. James CloosApr 2, 2007
  20. Peter EriksenApr 2, 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.