[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    Re: Very Fast: Directly Coded Lexical Analyzer
From:       Nicholas Nethercote <njn () csse ! unimelb ! edu ! au>
Date:       2007-05-31 22:46:47
Message-ID: Pine.GSO.4.61.0706010807590.4299 () mulga ! csse ! unimelb ! edu ! au
[Download RAW message or body]

On Thu, 31 May 2007, Andrew Haley wrote:

> No.  Speed is always measured in reciprocal units of time: s^-1.
> A program that runs in 10 seconds has a speed of 0.1 s^-1.  Thus, 200%
> is (0.1 * 200/100) s^-1 faster, giving a speed of 0.3 s^-1.

Um, 0.1 * 200/100 = 0.2.

Amdahl's Law says:

   speedup = t_old / t_new

Yet people often express it as a percentage, which is confusing, as we've 
just seen.  They write "1.2x faster" as "20% faster" and "3x faster" as 
"200% faster".

Another performance measure is reduction in execution time:

   reduction = 1 - (t_new / t_old)

That is more natural to express as a percentage.  But it's usually not what 
you want -- it's not what most people mean intuitively when they say "X is 
faster than Y" by a particular amount.

Growth of things is often expressed as a percentage, eg. saying "my wealth 
is 200% larger than last year" is fairly clear as meaning "3x larger". 
It's clear because there's only one possible measurement:  size.  That's why 
people use it in finance.  But when you're dealing with how fast programs 
run, because there are two possible measures ("speedup" and "reduction") a 
percentage is much less clear.

To confuse things further, if you use percentage for speedup, the two 
measures give very similar results, *for small performance improvements*. 
For example:

   t_old = 100s
   t_new = 90s
   speed-up = 1.11 (sometimes strangely written as 11%)
   reduction = 10%

But they diverge as the performance improvements get better.  I once saw a 
talk in which the speaker said he had sped up a system by 75%.  He really 
meant he had reduced the execution time by 75%, which meant it was running 
4x faster.  But I think everyone assumed a 1.75x speed-up until I asked for 
a clarification.  Since this "talk" was actually a thesis defense I think my 
question helped him significantly :)

It's amazing how much academic work doesn't make it clear what they mean by 
"10% faster".  And the responses to this thread show how confusing 
percentages are.  I encourage everyone to use Amdahl's law for speed-up and 
avoid percentages when talking about program performance.  If you say "I 
made it 3x faster" no-one will ever be confused.

Nick
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic