Re: [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.

2018-06-07 Thread Mark Wielaard
On Mon, Jun 04, 2018 at 07:05:16PM +0200, Mark Wielaard wrote: > Since we are single threaded we can just use a static result buffer for > format_dwarf_addr as long as we make sure to print the result before > calling format_dwarf_addr again. This removes lots of malloc/free calls. Almost as soon

Re: [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.

2018-06-06 Thread Mark Wielaard
On Mon, Jun 04, 2018 at 07:05:16PM +0200, Mark Wielaard wrote: > Since we are single threaded we can just use a static result buffer for > format_dwarf_addr as long as we make sure to print the result before > calling format_dwarf_addr again. This removes lots of malloc/free calls. > > On my machi

[PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.

2018-06-04 Thread Mark Wielaard
Since we are single threaded we can just use a static result buffer for format_dwarf_addr as long as we make sure to print the result before calling format_dwarf_addr again. This removes lots of malloc/free calls. On my machine eu-readelf -N --debug-dump=info libxul.so goes from 57 seconds to 55 s