Sha256: 97bdd0fb74e85244a56ff9c130ae6f9e3029ae18faa2d520cdf3a067cf08bc9e

Contents?: true

Size: 662 Bytes

Versions: 4

Compression:

Stored size: 662 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib"))

require "amq/protocol/client"

FRAME_SIZE = 128 * 1024

puts
puts "-" * 80
puts "Profiling on #{RUBY_DESCRIPTION}"

n = 250_000

# warm up the JIT, etc
puts "Doing a warmup run..."
15_000.times { AMQ::Protocol::Method.encode_body("ab" * 1024, 1, FRAME_SIZE) }

require 'ruby-prof'

# preallocate
ary = Array.new(n) { "ab" * 1024 }

puts "Doing main run..."
result = RubyProf.profile do
  n.times { |i| AMQ::Protocol::Method.encode_body(ary[i], 1, FRAME_SIZE) }
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
amq-protocol-1.9.0 profiling/pure/body_framing_with_2k_payload.rb
amq-protocol-1.8.0 profiling/pure/body_framing_with_2k_payload.rb
amq-protocol-1.7.0 profiling/pure/body_framing_with_2k_payload.rb
amq-protocol-1.6.0 profiling/pure/body_framing_with_2k_payload.rb