[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [PATCH] Saving a few cycles, part 2/2

From: Bolstridge, Andrew <andy.bolstridge_at_intergraph.com>
Date: Wed, 5 May 2010 17:28:44 +0100

> -----Original Message-----
> From: hyrum_at_hyrumwright.org [mailto:hyrum_at_hyrumwright.org] On Behalf
Of
> Hyrum K. Wright
> Sent: Wednesday, May 05, 2010 3:55 PM
> To: Peter Samuelson
> Cc: dev_at_subversion.apache.org
> Subject: Re: [PATCH] Saving a few cycles, part 2/2
>
...
> I would agree. I saw the commit of Stefan's patch, and independently
> thought about using a lookup table (though I prefer Peter's
> implementation).
> I don't have any hard performance numbers, but I gotta believe the
> lookup
> table is simpler, as well as more performant.
>

It may be simpler, but generally not as fast as arithmetic. The problem
(with modern processors) is that the table (or the entry you want) has
to be loaded into the CPU cache and that may require a main RAM access
that is very slow (relatively speaking) compared to a few maths
operations.

For example, you can do many instructions per clock cycle, but fetching
1 byte from main RAM (at 10ns delay) will take 30 clock cycles on a 3Ghz
chip (and that's a lot of maths instructions.... over a thousand).

I think it takes a lot longer than that, with slower latency RAM we use
today and 3 levels of cache. But the point is that a lookup table is no
longer necessarily faster than calculating the data. How times have
changed :)

Anyway, it's hardly going to be a big deal to overall performance, so
whatever is easier to maintain is best.
Received on 2010-05-05 18:29:17 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.