@Dekita - Try Ruby's benchmark...just copy benchmark.rb over from the distribution's lib folder to your game folder and require it in, then do
Benchmark.bmbm do |x| x.report("method1") { method1() } x.report("method2") { method2() }end
This could be a very misleading benchmark -- performing the benchmark a single time for each method just doesn't provide a very useful representation of each method's actual performance. As an example, try running these two benchmarks and see the difference:
require 'benchmark'# Personally, shows interpolation as approximately 1.5 times faster.Benchmark.bmbm do |x| x.report('concatenation') { 'hello, ' + 'world' } x.report('interpolation') { "hello, #{'world'}" }end# Now interpolation is more than three times as fast.Benchmark.bmbm do |x| i = 100_000 x.report('concatenation') { i.times { 'hello, ' + 'world' } } x.report('interpolation') { i.times { "hello, #{'world'}" } }endAlso, I wrote
this for precisely this purpose. The functionality is fundamentally similar to the Benchmark module, but allows you to write benchmarks in a more concise and generally nicer way. Plus, it's an Ace script that actually reports accurately when run from the RGSS3 Player, unlike the Benchmark module (which is
slightly misleading, as some of the information provided by Process is unreliable on Windows, because... you know, Windows).In addition, combine that script with the
SES Console and you can run your own benchmarks any time you like while play-testing your game just to try out various methods and how well they'd perform in the RGSS3 Player
as it's running.
Seriously, I wrote these tools to help scripters and the overall Ace scripting community. Use them, that's what they're there for.