[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] bsearch() speed optimization. Opinions?

From: Dmitry K.
Subject: [avr-libc-dev] bsearch() speed optimization. Opinions?
Date: Sun, 30 Jan 2005 11:44:23 +1000
User-agent: KMail/1.5

Hi all.

Now bsearch function uses multiplication to everyone itteration. This
operation can be excluded from a body of a cycle. I have tried to make
it. In result speed of search considerably increase (for classic avr-s),
but also the size of a code too has increased.

Certainly, it is possible to include a new variant only for classic
chips under condition of absence of a key `-Os', but I doubt, that such
combination for anybody can be useful.


Comparison old and new 'bsearch' is below resulted:

Search in 100-bytes array of chars (result was at first element).

avr2            3.3.5   3.3.5   3.4.3   3.4.3   4.0     4.0
~~~~            -Os rr  -O3     -Os rr  -O3     -Os rr  -O3

1.2.0   size:   78+12   86+14   77+12   89+14   77+12   92+14
        cls:    806     815     813     821     808     829

20050129 size:  93+14   93+14   83+12   106+14  89+12   106+14
         cls:   670     551     533     546     554     545


reply via email to

[Prev in Thread] Current Thread [Next in Thread]