Sha256: d5441b5bde2fcd8a5bc5be7d22ab50b82b10fcf711ee5650decee5080c7553ab
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require 'ws_light/set/gradient_set' require 'ws_light/set/rainbow_set' require 'ws_light/set/semolina_set' require 'ws_light/set/random_set' require 'ws_light/set/strawberry_set' require 'ws_light/set/watermelon_set' require 'ws_light/set/star_set' require 'benchmark' include Benchmark @gradient_set = WSLight::Set::GradientSet.new @rainbow_set = WSLight::Set::RainbowSet.new @semolina_set = WSLight::Set::SemolinaSet.new @random_set = WSLight::Set::RandomSet.new @strawberry_set = WSLight::Set::StrawberrySet.new @watermelon_set = WSLight::Set::WatermelonSet.new @star_set = WSLight::Set::StarSet.new @gradient_set.color_from = WSLight::Color.random_from_set @gradient_set.color_to = WSLight::Color.random_from_set n = 10_000 puts "Testing #{n} cycles over all sets..." Benchmark.bm(15) do |x| x.report('GradientSet:') { n.times do @gradient_set.frame end } x.report('RainbowSet:') { n.times do @rainbow_set.frame end } x.report('SemolinaSet:') { n.times do @semolina_set.frame end } x.report('RandomSet:') { n.times do @random_set.frame end } x.report('StrawberrySet:') { n.times do @strawberry_set.frame end } x.report('WatermelonSet:') { n.times do @watermelon_set.frame end } x.report('StarSet:') { n.times do @star_set.frame end } end puts "To run smoothly, the benchmarks should all be lower than #{n/50.0} seconds."
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ws_light-0.4.2 | lib/ws_light/benchmark/set_benchmark.rb |