VIP23 (VSL refactoring) design sketch

Geoff Simmons geoff at uplex.de
Wed Apr 10 14:59:31 UTC 2019


On 4/10/19 16:24, Nils Goroll wrote:
> 
> I wonder though if all things considered (format string parsing, definition
> lookup, varargs processing) this pays off. I got no data on this, but one
> counter-argument might be that, for custom functions, one would expect no/very
> few conditionals, so we would likely see no/very few pipeline stalls .

Remember that this started out when we were considering varnishlog -j.
If the output is to be truly JSON-like, we'd want the data for something
like (Be)ReqAcct to be an object with six integers, rather than a
whitespace-separated string of digit strings.

But yes, writing the binary data efficiently into log buffers, where now
it's mostly vsnprintf(), becomes the challenge. Both of the vsnprintf()
and a new function run through varargs, and both parse a format string
if that's what we'll use. The new function will just copy data instead
of doing things like repeatedly dividing by 10 -- that's where we're
going for a win.

But of course we'd be competing against the many years that have gone
into optimizing the library printf code.

(If vsnprintf() has a way to do it all without branching, I'd like to
see how.)

BTW I've now understood one of the attractions of the format string --
the type-correctness of the args can be checked at compile-time.

So I'm starting to come over to the format-string camp. If we're
generating code from .rst-like resources, as currently with .vsc, we
could use Python to generate the formats, that way we're sure to get
them right.


Best,
Geoff
-- 
** * * UPLEX - Nils Goroll Systemoptimierung

Scheffelstraße 32
22301 Hamburg

Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753

http://uplex.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20190410/ff493cc9/attachment-0001.bin>


More information about the varnish-dev mailing list