[PATCH] make "fast unlzma" code much smaller
Denis Vlasenko
vda at ilport.com.ua
Thu Mar 9 22:21:58 PST 2006
On Thursday 09 March 2006 19:35, Rob Landley wrote:
> On Thursday 09 March 2006 4:34 am, Denis Vlasenko wrote:
> > This patch improves inlining decisions in
> > archival/libunarchive/rangecoder.h so that:
> >
> > "fast unlzma" code is ~45% smaller with ~2% speed loss
> > "small unlzma" code is 17% faster with 10% size increase
>
> #1 is good, #2 is bad. Is there any way to have #1 without #2?
Yes: http://195.66.192.167/linux/bbox/unlzma_size_v2.patch
These two patches (v1 and v2) differ only in having
"always_inline" for v1 and "speed_inline" for v2 here:
/* Called ~10 times, but very small, thus inlined */
static speed_inline void rc_update_bit_0(rc_t * rc, uint16_t * p)
{
rc->range = rc->bound;
*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
}
static speed_inline void rc_update_bit_1(rc_t * rc, uint16_t * p)
{
rc->range -= rc->bound;
Thus "small unlzma" v1 is faster and v2 is smaller.
"fast unlzma" is identical for v1 and v2.
--
vda
More information about the busybox
mailing list