[PATCH] Reduce code size of _REENT_INIT_PTR()

Sebastian Huber sebastian.huber@embedded-brains.de
Sat Apr 27 12:37:00 GMT 2013


On 26/04/13 21:55, Freddie Chopin wrote:
> W dniu 2013-04-26 21:42, Yaakov (Cygwin/X) pisze:
>> On 2013-04-26 03:43, Sebastian Huber wrote:
>>> Use one memset() to initialize everything to zero.  Set non-zero fields
>>> in a second step.  There is only a small runtime overhead, but the code
>>> size is greatly reduced.  This change assumes the NULL pointer and '\0'
>>> are encoded as zero bits.
>>
>> This sounds like a candidate for PREFER_SIZE_OVER_SPEED, but AFAICS that
>> would mean moving that definition out of configure.host and into
>> sys/config.h.
>
> I'm almost sure that memset() version will be both faster and smaller, 
> especially because there was a memset() call anyway... In my opinion 
> there is no tradeoff in this change - it's just better.

Due to the atexit() stuff in struct _reent the overhead is approximately 
memset(0, 0, 400)

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list