[fpc-other] Re: Shootout: k-nucleotide implementation (was: Which
programming language is fastest?)
Bernd Kreuss
prof7bit at googlemail.com
Sat May 14 21:50:09 CEST 2011
On 14.05.2011 20:02, Mattias Gaertner wrote:
> But afaik it turned out that these optimizations and the
> discussions didn't help any real world application. So it is an
> interesting sport for some programmers, but mostly a waste of time for
> all others.
I think its still useful doing this sport to learn a bit about not so
obvious oddities of the compiler that one would only notice by coincidence.
For example by doing this I have (accidentally) learned that (with FPC
2.4.2) the expression
(x shr 1) and $03
would for some reason be translated into *much* smaller and faster code
(it reduced the total time of a tight loop by roughly factor two!) than
the following code to achieve the same:
(x and $06) shr 1
which I would have never intuitively expected to happen. And I believe
there exist more such "tricks". For example using different loop
constructs, it seems for example after a bit of experimenting I should
often favor the repeat until loop over all other types of loops.
Bernd
More information about the fpc-other
mailing list