Re: [PATCH] alloc.c: replace alloc by mempool

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

 



On Fri, May 4, 2018 at 12:18 AM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
> I just measured on git.git and linux.git (both of which are not *huge* by
> any standard, but should give a good indication. linux has  6M objects,
> and when allocating 1024 at a time, we run into the new block allocation
> ~6000 times).
>
> I could not measure any meaningful difference.
>
> linux.git $ git count-objects -v
> count: 0
> size: 0
> in-pack: 6036543
> packs: 2
> size-pack: 2492985
> prune-packable: 0
> garbage: 0
> size-garbage: 0
>
> (with this patch)
>  Performance counter stats for '/u/git/git count-objects -v' (30 runs):
>
>           2.123683      task-clock:u (msec)       #    0.831 CPUs utilized            ( +-  2.32% )
>                  0      context-switches:u        #    0.000 K/sec
>                  0      cpu-migrations:u          #    0.000 K/sec
>                126      page-faults:u             #    0.059 M/sec                    ( +-  0.22% )
>            895,900      cycles:u                  #    0.422 GHz                      ( +-  1.40% )
>            976,596      instructions:u            #    1.09  insn per cycle           ( +-  0.01% )
>            218,256      branches:u                #  102.772 M/sec                    ( +-  0.01% )
>              8,331      branch-misses:u           #    3.82% of all branches          ( +-  0.61% )
>
>        0.002556203 seconds time elapsed                                          ( +-  2.20% )
>
>   Performance counter stats for 'git count-objects -v' (30 runs):
>
>           2.410352      task-clock:u (msec)       #    0.801 CPUs utilized            ( +-  2.79% )
>                  0      context-switches:u        #    0.000 K/sec
>                  0      cpu-migrations:u          #    0.000 K/sec
>                131      page-faults:u             #    0.054 M/sec                    ( +-  0.16% )
>            993,301      cycles:u                  #    0.412 GHz                      ( +-  1.99% )
>          1,087,428      instructions:u            #    1.09  insn per cycle           ( +-  0.02% )
>            244,292      branches:u                #  101.351 M/sec                    ( +-  0.02% )
>              9,264      branch-misses:u           #    3.79% of all branches          ( +-  0.57% )
>
>        0.003010854 seconds time elapsed                                          ( +-  2.54% )
>
> So I think we could just replace it for now and optimize again later, if it
> turns out to be a problem. I think the easiest optimisation is to increase
> the allocation size of having a lot more objects per mp_block.

Yeah. I also tested this from a different angle: memory overhead. For
2M objects with one mp_block containing 1024 objects (same setting as
alloc.c), the overhead (not counting malloc() internal overhead) is
46KB and we don't have any extra overhead due to padding between
objects. This is true for all struct blob, commit, tree and tag. This
is really good. alloc.c has zero overhead when measured this way but
46KB is practically zero to me.
-- 
Duy



[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]

  Powered by Linux