Sha256: 04a419534e792a354bb7c2331f7777acdf52dcf72ca0a1feef76de8ca5371741
Contents?: true
Size: 634 Bytes
Versions: 5
Compression:
Stored size: 634 Bytes
Contents
# encoding: utf-8 require 'rubygems' require 'bundler/setup' require 'benchmark/ips' require 'escape_utils' 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, from #{url}" Benchmark.ips do |x| x.report "EscapeUtils.escape_javascript" do |times| times.times do EscapeUtils.unescape_javascript(escaped_javascript) end end end
Version data entries
5 entries across 5 versions & 1 rubygems