Skip to content

Instantly share code, notes, and snippets.

@RomainFranceschini
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RomainFranceschini/6ee524638f97f3fe1449 to your computer and use it in GitHub Desktop.
Save RomainFranceschini/6ee524638f97f3fe1449 to your computer and use it in GitHub Desktop.
DEVStone benchmark
# To run this benchmark
# $ git clone https://github.com/devs-ruby/devs .
# $ gem build devs.gemspec && gem install devs-0.5.1.gem
# $ gem install devs-models
# $ git clone https://github.com/devs-ruby/devstone .
# $ gem build devs.gemspec && gem install devstone-0.0.1.gem
require 'devstone'
opt_base = {
internal_transition_time: 0,
external_transition_time: 0,
type: :hi,
maintain_hierarchy: true
}
disable_gc = false
iteration = 1
widths = (50..2000).step(50).to_a
depths = [3]
puts "width - init time - simulation time"
widths.each do |width|
depths.each do |depth|
iteration.times do |i|
GC.disable if disable_gc
simulation = DEVStone.generate_and_simulate(:pdevs, opt_base.merge({depth: depth, width: width}))
puts "#{width} #{simulation.build_elapsed_secs.round(6)} #{simulation.elapsed_secs.round(6)}"
GC.enable if disable_gc
GC.start
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment