Sha256: e78c88de55bc679851e959be8384d20b77ed96dcbeb44aa29f6d7a0e7c87f62f

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

# encoding: utf-8
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'rubygems'
require 'benchmark'

require 'escape_utils'

times = 100
url = "http://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js.uncompressed.js"
javascript = `curl -s #{url}`
escaped_javascript = EscapeUtils.escape_javascript(javascript)
puts "Escaping #{escaped_javascript.bytesize} bytes of javascript #{times} times, from #{url}"

Benchmark.bmbm do |x|
  x.report "EscapeUtils.escape_javascript" do
    times.times do
      EscapeUtils.unescape_javascript(escaped_javascript)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
escape_utils-0.2.3 benchmark/javascript_unescape.rb
escape_utils-0.2.2 benchmark/javascript_unescape.rb