Sha256: 1a511128aead2dead3973eec4db9416d2bc584cfe75381fb9fd37aa1502ca22c

Contents?: true

Size: 917 Bytes

Versions: 50

Compression:

Stored size: 917 Bytes

Contents

# Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario
# See MIT-LICENSE

require 'rubygems'
require 'ffi_yajl'

module FFI_Yajl
  class Benchmark
    class ParseProfileRubyProf

      def run
        begin
          require 'ruby-prof'
        rescue Exception
          puts "INFO: perftools.rb gem not installed"
        end

        if defined?(RubyProf)
          filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json"))
          json = File.new(filename, 'r').read

          times = 1000
          puts "Starting profiling encoding #{filename} #{times} times\n\n"

          result = RubyProf.profile do
            times.times {
              output = FFI_Yajl::Parser.parse(json)
            }
          end

          printer = RubyProf::GraphPrinter.new(result)
          printer.print(STDOUT, {})

        end
      end

    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
ffi-yajl-2.2.0 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-2.2.0-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-2.1.0-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-2.1.0 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-2.0.0-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-2.0.0 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.4.0-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.4.0 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.3.1-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.3.1 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.3.0-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.3.0 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.2.0-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.2.0 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.1.0-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.1.0 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.0.2-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.0.2 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.0.1-universal-java lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
ffi-yajl-1.0.1 lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb