Sha256: 280db663ae78b95c199b67285141127831ddde7fda762dba1b74e97f31b0918c

Contents?: true

Size: 1.59 KB

Versions: 265

Compression:

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

265 entries across 118 versions & 8 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.5 vendor/bundle/gems/sass-3.1.15/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.4 vendor/bundle/gems/sass-3.1.15/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.3 vendor/bundle/gems/sass-3.1.15/vendor/fssm/profile/prof-pathname.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/fssm-0.2.10/profile/prof-pathname.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/fssm-0.2.10/profile/prof-pathname.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/haml-3.1.8/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.2 vendor/bundle/gems/sass-3.1.15/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/profile/prof-pathname.rb
classiccms-0.7.1 vendor/bundle/gems/sass-3.1.15/vendor/fssm/profile/prof-pathname.rb