Sha256: c32ffc07984418e77cc2886d54584f2b2bbcbe6501ef601088d951d1d6bda3f1

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

require 'ws2801'
require 'benchmark'
include Benchmark

WS2801.length(320)

light = [1] * 320 * 3
dark = [0] * 320 * 3

n = 1000

puts "Testing #{n} writes to the led strip..."

Benchmark.bm(15) do |x|
  x.report('Write:') { n.times do |i| WS2801.strip(i % 2 == 0 ? light : dark); WS2801.write end }
end

puts "To run smoothly, the benchmarks should all be lower than #{n/50.0} seconds."

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ws_light-0.4.2 lib/ws_light/benchmark/ws2801_benchmark.rb
ws_light-0.3.0 lib/ws_light/benchmark/ws2801_benchmark.rb
ws_light-0.2.0 lib/ws_light/benchmark/ws2801_benchmark.rb