[master] 5e5b442f5 VSLb() is not the choice for a single string argument

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Jul 20 17:29:44 UTC 2022


--------
Dridi Boukelmoune writes:
> > > Yes it should. But why not avoid an snprintf if we can?
> >
> > +0
> >
> > At least on FreeBSD it is surprisingly cheap.  In the normal
> > case, for instance printf("%s", ...) it is free, because the
> > compiler turns it into a fputs() instead.
>
> But that kind of optimization wouldn't happen for VSLb("%s") calls?
> That sounds like a very long shot.

I'd hope not :-)

But "%s" is still surprisingly cheap, even when the compiler does
not remove it.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the varnish-commit mailing list