Sha256: 8e76673c16bc19a6f72273db92d177662aeb1218031676ecf46a7e20899bb95f

Contents?: true

Size: 895 Bytes

Versions: 202

Compression:

Stored size: 895 Bytes

Contents

#!/usr/bin/env ruby

#--
# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
# Portions copyright 2005 by Sam Ruby (rubys@intertwingly.net).
# All rights reserved.

# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
#++

require 'builder/xmlmarkup'
require 'benchmark'

text = "This is a test of the new xml markup. Iñtërnâtiônàlizætiøn\n" * 10000

include Benchmark          # we need the CAPTION and FMTSTR constants
include Builder
n = 50
Benchmark.benchmark do |bm|
  tf = bm.report("base")   {
    n.times do
      x = XmlMarkup.new
      x.text(text)
      x.target!
    end
  }
  def XmlMarkup._escape(text)
    text.to_xs
  end
  tf = bm.report("to_xs")   {
    n.times do
      x = XmlMarkup.new
      x.text(text)
      x.target!
    end
  }
end

Version data entries

202 entries across 173 versions & 30 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/builder-3.0.4/test/performance.rb
classiccms-0.7.5 vendor/bundle/gems/builder-3.0.0/test/performance.rb
classiccms-0.7.4 vendor/bundle/gems/builder-3.0.0/test/performance.rb
classiccms-0.7.3 vendor/bundle/gems/builder-3.0.0/test/performance.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/builder-3.0.4/test/performance.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/builder-3.0.4/test/performance.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/builder-3.0.4/test/performance.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/builder-3.0.4/test/performance.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/builder-3.0.4/test/performance.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/builder-3.0.4/test/performance.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/builder-3.0.4/test/performance.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/builder-3.0.4/test/performance.rb
candlepin-api-0.4.0 bundle/ruby/gems/builder-3.0.0/test/performance.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/builder-3.0.0/test/performance.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/builder-3.0.0/test/performance.rb
challah-1.0.0 vendor/bundle/gems/builder-3.1.4/test/performance.rb
classiccms-0.7.2 vendor/bundle/gems/builder-3.0.0/test/performance.rb
classiccms-0.7.1 vendor/bundle/gems/builder-3.0.0/test/performance.rb
swipe-rails-0.0.5 vendor/bundle/gems/builder-3.0.4/test/performance.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/builder-3.0.4/test/performance.rb