Sha256: da3da5a8609d149a37267463575c6edd76b658dda873ab5d3775c80bcc3a377e

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require "rbench"
require 'hashie'

require File.dirname(__FILE__) + "/../../lib/garterbelt"
require File.dirname(__FILE__) + '/templates/garterbelt'

TIMES = 10_000

require 'ruby-prof'

# Profile the code
@view = Garterbelt::View.new
@tag = Garterbelt::ContentTag.new(:type => :p, :view => @view) do
  @view._buffer << Garterbelt::ContentTag.new(:type => :span, :view => @view, :content => 'spanning')
  @view._buffer << Garterbelt::Text.new(:content => ' so much time here', :view => @view)
end

result = RubyProf.profile do
  TIMES.times do
    @tag.render
  end
end

# Print a graph profile to text
printer = RubyProf::GraphPrinter.new(result)
printer.print(STDOUT, 0)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
garterbelt-0.1.1 spec/performance/profiling.rb
garterbelt-0.1.0 spec/performance/profiling.rb