From: Joe Van Dyk Date: 2005-11-11T13:27:34+09:00 Subject: Re: Accurate Timing in ruby On 11/10/05, Eric Hofreiter wrote: > Believe it or not, I'm attempting to make an action-driven game with ruby. Is there a way to get the time in milliseconds since the program started, or something similar? I've tried using Time.now.to_f, but all too often that value will be the same in two consecutive update calls, causing jumps in motion and "infinite" fps readings. Would Time.now.usec help? Returns the time in microseconds. > Also, will extending calculation-heavy classes to C up the performance enough to make a fairly sophisticated game run? I'm talking like maybe a NES sports game as far as complexity goes. For example, a vector class has about 15-20 methods that all do a few simple computations. Would C significantly speed that up or would the fact that ruby still has to make the calls bog it back down? Don't use C unless you're sure that Ruby isn't fast enough, and be sure you know where the code is not fast enough. And then optimize the slow code (first by using a better algorithm, and then by using a better algorithm, and then use C).