"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: chores; move patch send/recv to privsep.c
To:
Stefan Sperling <stsp@stsp.name>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 05 Jul 2022 12:57:45 +0200

Download raw body.

Thread
Stefan Sperling <stsp@stsp.name> wrote:
> On Tue, Jul 05, 2022 at 10:52:22AM +0200, Omar Polo wrote:
> > However, got-read-pack needs a big chunk of privsep.c anyway and it's a
> > very frequently used one, so trimming down the size of privsep.c helps
> > there too but not in a particularly significant way.
> 
> Maybe we could create a privsep_pack.c for all the stuff got-read-pack
> needs and the other helpers do not?
> 
> That would already make privsep.c much smaller, and it will be trivial
> to split it up more, e.g. per object type: privsep_blob.c,
> privsep_tree.c, etc., and have a privsep_child.c for the forking code.

I gave it a spin for fun and turns out it's almost straightforward to
do! :)

The diff is quite long (~7K) so instead of attaching it I'm linking my
repo:
https://git.omarpolo.com/?index_page=&path=got.git&action=summary&headref=split

(checkout the branch 'split')

It's not ready as-is still, privsep_misc.c is not a good name and
there's a small hack in keeping two copies of static functions so it
builds, but apart from that it seems to be working.  (gotweb included)

The various libexec helpers loose quite a bit of weight:

before     after    stripped
 245K      155K      77.7K   got-fetch-pack
 315K      232K       111K   got-index-pack
 213K      125K      60.9K   got-read-blob
 213K      127K      61.3K   got-read-commit
 239K      148K      73.5K   got-read-gitconfig
 255K      165K      84.2K   got-read-gotconfig
 213K      127K      61.6K   got-read-object
 349K      299K       135K   got-read-pack
 223K      132K      66.4K   got-read-patch
 213K      126K      61.1K   got-read-tag
 213K      128K      62.2K   got-read-tree
 238K      148K      73.8K   got-send-pack

This on debug build (-O0 -g).  With release builds the numbers may be
a bit different.

Anyway, I'm not sure wether to push this forward right now.  With gotd
to write I don't want to make noise and slow down things if there isn't
an agreed good reason to do that.  It's been a fun experiment and I can
always bring it up again later :)