Sha256: d3cbbf40313a2cdb05de30b6a948aff108c3f109d88376aba7acf8d31f6e8a60

Contents?: true

Size: 711 Bytes

Versions: 5

Compression:

Stored size: 711 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

5 entries across 5 versions & 1 rubygems

Version Path
garterbelt-0.0.9 spec/performance/profiling.rb
garterbelt-0.0.8 spec/performance/profiling.rb
garterbelt-0.0.7 spec/performance/profiling.rb
garterbelt-0.0.6 spec/performance/profiling.rb
garterbelt-0.0.5 spec/performance/profiling.rb