Hi,

Gerben van den Broeke wrote:
[...]
Improvement:
By not only noting down the size of the smallest hole, but also noting its 
addrress, the second loop is not necessary anymore.

The cost:
2 more pointers are needed (both the found hole and the hole before it must be 
remembered), so it might add 4 pushes at the beginning and 4 pops at the end of 
the function.
In the first loop two movw's are needed to note down the hole address, which 
are executed everytime a smaller hole is found.

This seems like a nice optimization :)

However, couldn't you just save the pointer to the _previous_ hole, and use sfp->nx to get the actual hole? This should reduce the cost a bit and make the patch even more attractive.

--
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"There are 10 kinds of people in the world, those who understand
binary and those who don't"


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to