TruerWords Logo
Google
 
Web www.truerwords.net

Search TruerWords

Welcome
Sign Up  Log On

“Updated Frontier's Script Profiler”

From: Seth Dillingham In Response To: Top of Thread.  
Date Posted: Monday, January 10, 2005 6:23:06 PM Replies: 0
   
Enclosures: None.

This weekend, I updated Frontier's script profiler to track script performance in milliseconds (thousandths of a second) instead of ticks (sixtieth's of a second).

While I was in there, I added a clock.milliseconds() verb.

The combination of all the optimizations we're doing and the speed of modern computers has rendered ticks a lot less useful than they used to be. For an example, consider the following code:

local ( secs = 10 )
local ( targTicks = clock.ticks() + ( secs * 60 ) )

loop if ( clock.ticks() >= targTicks ) break i++

msg( i + " calls in " + secs + " seconds." )

After this runs on my Mac G4/450, the value of i is approximately 140,000. On my Athlon, the value of i is about 1,400,000.

My point is that, like clock.ticks itself, most of the verbs in Frontier run in less than one tick. Since the profiler was only measuring ticks, it was sometimes difficult to see where the performance bottlenecks were. If one of the verbs in your profile table always runs in less than half of a tick, odds are good that more than half of the calls to that verb will never even increment the profiler's tick counter. This makes it very easy to completely miss real opportunities for script optimization.

Improving the profiler's granularity from ticks to milliseconds makes the profiles more useful and trustworthy because they're more precise.

Andre and I agreed that we'd like to see it taken all the way to microseconds. Unfortunately, at 1,000,000 microseconds per second, some of the slower verbs (like string verbs operating on very large strings, or verbs which must visit very large tables) would run a significant risk of over-running the limits of Frontier's maximimum long value. Being told that a verb run in -1,874,936,265 microseconds isn't particularly helpful. ;-)


Discussion Thread:

There are no replies.

Trackbacks:

There are no trackbacks.



TruerWords
is Seth Dillingham's
personal web site.
More than the sum of my parts.