begin  quoting John H. Robinson, IV as of Wed, Aug 23, 2006 at 09:05:49AM -0700:
[snip]
> Until you make the wrong guess, spend a lot of time optimising a section
> of code that, you thought would get run most of the time, ends up with
> .01% of the actual run time.

Heh.

We had a need for a way to change and combine weights in a cost
algorithm by changing a configuration file.

So remembering how easy forth interpreters were, I wrote a little
RPN interpreter/calculator (but not a two-stack machine, just a
one-stack).  Each "word" was an object. It used Integers and 
Doubles (objects) for math, not ints and doubles.

It was pretty crude. It had no optimization. It created a lot of objects
to do a computation.  It tokenized a lot of strings. It *looked* slow.

It was being called a gazillion time. I figured it would be one
of the biggest bottlenecks.

...

It didn't even show up in the profiler until we'd been profiling
and fixing bottlenecks for a couple of weeks.  By then, it took up
0.02% of the execution time.

-- 
_ |\_
 \|

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to