Re: suggestion: slight optimization for UT_String


Subject: Re: suggestion: slight optimization for UT_String
From: Vlad Harchev (hvv@hippo.ru)
Date: Mon Mar 19 2001 - 13:05:55 CST


On 19 Mar 2001, Joaquin Cuenca Abela wrote:

> On 19 Mar 2001 14:04:57 +0400, Vlad Harchev wrote:
> >
> > Then the following could be used to multiply 'x' by 1.5:
> > (x + x<<1) >> 1
> >
> > I will be very fast.

 Hmm, that would be better written as
        x + x>>1
 That will definitely be faster than x*1.5
 
> uhm, it's not so readable as x = x * 1.5. In addition, if later we
> decide to change from 1.5 to something else, it becomes harder. And in

 We may decide not to change it simply..

> addition I don't think that this "optimization" is need at all (of
> course, some figures will shut me down).

 As for whether it will help at all - I doubt that too - those 4+ saved CPU
cycles won't change anything..

> Cheers,
>
> --
> Joaquín Cuenca Abela
> cuenca@celium.net
>

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Mon Mar 19 2001 - 13:59:05 CST