Sha256: 0d369dc45e990d11b80d31bfc08d84c8d5e03a7b0134d9528a9d8727e2e3fb1a
Contents?: true
Size: 765 Bytes
Versions: 6
Compression:
Stored size: 765 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}` javascript = javascript.force_encoding('utf-8') if javascript.respond_to?(:force_encoding) 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
6 entries across 6 versions & 1 rubygems