Re: Distribution of longest common hash prefixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "Randal" == Randal L Schwartz <merlyn@xxxxxxxxxxxxxx> 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@xxxxxxxxxxx>         OpenPGP: 1024D/ED7DAEA6
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]