RockPaperScissors

LizardSpock

Ruby Performance Measure

| Comments

Also available as a gist. Very simple way of measuring execution time in seconds using Ruby

#!/usr/bin/env ruby
# Measure performance in seconds of tasks
# Record Startime For performance measurements
startTime = Time.now

#Main part of script goes here

#Calculate and Display Execution Time in seconds
execTime = Time.now - startTime
puts "Execution time #{execTime} seconds."

Matlab has a slightly simpler function for this

tic
%Main part goes here
toc

Comments