Sha256: 6b589759c25dce4f73194ecaeb23120ae31610444c9477035a1f5a1c98c0da12

Contents?: true

Size: 1.58 KB

Versions: 299

Compression:

Stored size: 1.58 KB

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'fssm'
require 'pathname'

require 'rubygems'
require 'ruby-prof'

$test_path = "#{Pathname.new('..').expand_path}"
$iterations = 90000

class Pathname
  # original segments implementation I was using with
  # the plain ruby Pathname library.
  def segments
    prefix, names = split_names(@path)
    names.unshift(prefix) unless prefix.empty?
    names.shift if names[0] == '.'
    names
  end
end

core_result = Pathname.new($test_path).segments
fssm_result = FSSM::Pathname.new($test_path).segments
raise Exception, "#{core_result.inspect} != #{fssm_result.inspect}\nFSSM::Pathname is incompatible with Pathname" unless core_result == fssm_result

RubyProf.start
RubyProf.pause

$iterations.times do |num|
  iteration = "%-6d" % (num + 1)
  puts "FSSM::Pathname iteration #{iteration}"

  RubyProf.resume
  p = FSSM::Pathname.new($test_path)
  segments = p.segments
  RubyProf.pause
end

puts "\nFSSM Pathname profile finished\n\n"

result = RubyProf.stop
output = File.new('prof-fssm-pathname.html', 'w+')

printer = RubyProf::GraphHtmlPrinter.new(result)
printer.print(output, :min_percent => 1)


RubyProf.start
RubyProf.pause

$iterations.times do |num|
  iteration = "%-6d" % (num + 1)
  puts "::Pathname iteration #{iteration}"

  RubyProf.resume
  p = ::Pathname.new($test_path)
  segments = p.segments
  RubyProf.pause
end

puts "\nruby Pathname profile finished\n\n"

result = RubyProf.stop
output = File.new('prof-plain-pathname.html', 'w+')

printer = RubyProf::GraphHtmlPrinter.new(result)
printer.print(output, :min_percent => 1)

Version data entries

299 entries across 299 versions & 5 rubygems

Version Path
haml-3.1.3 vendor/sass/vendor/fssm/profile/prof-pathname.rb
haml-3.2.0.alpha.8 vendor/sass/vendor/fssm/profile/prof-pathname.rb
sass-3.1.4 vendor/fssm/profile/prof-pathname.rb
sass-3.2.0.alpha.11 vendor/fssm/profile/prof-pathname.rb
sass-3.1.3 vendor/fssm/profile/prof-pathname.rb
sass-3.2.0.alpha.9 vendor/fssm/profile/prof-pathname.rb
sass-3.2.0.alpha.8 vendor/fssm/profile/prof-pathname.rb
haml-3.2.0.alpha.5 vendor/sass/vendor/fssm/profile/prof-pathname.rb
haml-3.2.0.alpha.4 vendor/sass/vendor/fssm/profile/prof-pathname.rb
haml-3.1.2 vendor/sass/vendor/fssm/profile/prof-pathname.rb
sass-3.1.2 vendor/fssm/profile/prof-pathname.rb
sass-3.2.0.alpha.7 vendor/fssm/profile/prof-pathname.rb
sass-3.2.0.alpha.6 vendor/fssm/profile/prof-pathname.rb
radiant-1.0.0.rc1 vendor/plugins/haml/vendor/fssm/profile/prof-pathname.rb
haml-3.2.0.alpha.3 vendor/sass/vendor/fssm/profile/prof-pathname.rb
sass-3.2.0.alpha.4 vendor/fssm/profile/prof-pathname.rb
sass-3.2.0.alpha.3 vendor/fssm/profile/prof-pathname.rb
sass-3.1.1 vendor/fssm/profile/prof-pathname.rb
haml-3.2.0.alpha.2 vendor/sass/vendor/fssm/profile/prof-pathname.rb
haml-3.1.1 vendor/sass/vendor/fssm/profile/prof-pathname.rb