[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04190] Re: How-to time short intervals?

From: Dave Thomas <Dave@...>
Date: 2000-07-24 16:22:34 UTC
List: ruby-talk #4190
Robert Feldt <feldt@ce.chalmers.se> writes:

> Ok, so we can't hope for anything better than secs/millisecs without going
> platform-specific then. Point taken on relying on anything less than secs.
> However I'm not relying on them for any critical func; I'm writing some
> performance tests.

Most common hardware does not have a particularly high resolution RTC, 
so the limitation occurs even below the software level.

I'd guess your best bet would be to use the benchmark module and call
your code in a loop a couple of million times. You'll need to write a
stubbed version that has just the entry point and a return. Time that 
too, and subtract the result from the value for the real routine to
find out how much time your actual code is taking.

(But I bet I'm just teaching you to suck eggs, here, aren't I ;-)


Dave

In This Thread