On 04/02/11 18:23, Bruno Haible wrote:
> Hi Pádraig,
> 
>> There was lots of heap interaction going on,
>> and by using the attached patch (only illustrative, may leak,
>> is not thread safe, ...) to cache the PRINTF_PARSE result
>> it increases the throughput to 5.8MB/s
> 
> Adding a global cache like this is hairy. Maybe we could get a
> speedup by letting the application allocate and manage a hash
> table that is used as a cache...?

Or provide a context variable so that's managed internally.
An interface change in any case :(

> Anyway, the immediate need to malloc() should be reduced with this patch.
> It trades malloc() against a bit more room on the stack. With it, I see
> a performance improvement in my test case of a factor 1.75. How much does
> it help on yours?

$ timeout 2 ./od -Ax -tx1z -v /dev/zero | pv >/dev/null
2.38MB 0:00:02 [1.21MB/s]

... | patch ....

$ timeout 2 ./od -Ax -tx1z -v /dev/zero | pv >/dev/null
 7.5MB 0:00:02 [3.85MB/s]

Thanks Bruno!

Pádraig.

Reply via email to