Re: Efficient Programming
- From: Richard E Maine <nospam@xxxxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 09:28:32 -0700
In article <d9p8ul$lt9$1@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
Salomon Turgman <sturgman@xxxxxxxxx> wrote:
> Joost wrote:
> > without even worrying about the program at all ... I think you'll be
> > accessing the memory in a different and less effective way in program
> > 2.
> But wouldnt the less amount of looping in program 2 be much better?
> That was my initial logic initially. And also there are no if checks in
> program 2.
I haven't taken the time to study the actual code, but in current
systems, performance is often dominated by memory access issues.
Certainly other things can be important, but memory access patterns are
typically the first thing to look for.
Do note that this has *NOT* always been the case. If you picked up
performance tuning tricks from a few decades ago, you need to realize
that they are no longer current. Yes, there are some general principles
that still apply (including the universal one that getting a good
algorithm is more important than any other kind of performance tuning),
but some of the details are really quite different. We used to do things
like count floating point operations (flops), which now are often
Anyway, I need to run now, but I'd say that if you really want to
understand the performance differences here, you should start by looking
at memory access patterns. How many memory access are there and how many
of those are likely to be satisfied from cache?
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
- Prev by Date: Re: Efficient Programming
- Next by Date: Re: Efficient Programming
- Previous by thread: Re: Efficient Programming
- Next by thread: Re: Efficient Programming