Sha256: 12486e7697fc840f8feb5cc9863f34d1180f75659a54253d4ad2a9dbfefbffca

Contents?: true

Size: 983 Bytes

Versions: 101

Compression:

Stored size: 983 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true
# encoding: iso-8859-1

#--
# 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

101 entries across 63 versions & 23 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/builder-3.3.0/test/performance.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/builder-3.3.0/test/performance.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/builder-3.3.0/test/performance.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/builder-3.2.4/test/performance.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/builder-3.2.4/test/performance.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/builder-3.2.4/test/performance.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/builder-3.3.0/test/performance.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/builder-3.3.0/test/performance.rb
builder-3.3.0 test/performance.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/builder-3.2.4/test/performance.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/builder-3.2.4/test/performance.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/builder-3.2.4/test/performance.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/builder-3.2.4/test/performance.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/performance.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/performance.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/performance.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/performance.rb
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/performance.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/builder-3.2.4/test/performance.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/builder-3.2.4/test/performance.rb