Joerg Jung wrote:
> > 
> > Michael McConville wrote:
> > 
> > Relayd, httpd, and ntpd define the functions get_data() and
> > get_string(). Both call calloc and then immediately memcpy. Calloc's
> > zeroing isn't optimized out. These functions are called in network data
> > paths in at least a couple places, so all this extra writing could have
> > a meaningful performance impact.
> 
> I think this impact is negligible small and I believe that you can not
> even measure it. So this change makes not so much sense to me.

I tried tracing calloc calls on a typical HTTP request and didn't find
much. I came across the fact that gmtime_r(3) callocs >41 KB, which is
unfortunate, but I don't know if there's an easy way around that.

> I wonder if using strndup() would make more sense for the first case
> here?

I was thinking the same thing. I guess it doesn't matter much, though.

Reply via email to