escape_utils 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/benchmark/html_escape.rb +6 -12
- data/benchmark/html_unescape.rb +2 -4
- data/benchmark/javascript_escape.rb +2 -4
- data/benchmark/javascript_unescape.rb +1 -2
- data/benchmark/url_escape.rb +6 -12
- data/benchmark/url_unescape.rb +5 -10
- data/ext/escape_utils/escape_utils.c +1 -1
- data/lib/escape_utils/version.rb +1 -1
- metadata +6 -6
data/CHANGELOG.md
CHANGED
data/benchmark/html_escape.rb
CHANGED
@@ -22,43 +22,37 @@ html = `curl -s #{url}`
|
|
22
22
|
puts "Escaping #{html.bytesize} bytes of html #{times} times, from #{url}"
|
23
23
|
|
24
24
|
Benchmark.bmbm do |x|
|
25
|
-
x.report do
|
26
|
-
puts "Rack::Utils.escape_html"
|
25
|
+
x.report "Rack::Utils.escape_html" do
|
27
26
|
times.times do
|
28
27
|
Rack::Utils.escape_html(html)
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
|
-
x.report do
|
33
|
-
puts "Haml::Helpers.html_escape"
|
31
|
+
x.report "Haml::Helpers.html_escape" do
|
34
32
|
times.times do
|
35
33
|
HamlBench.html_escape(html)
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
39
|
-
x.report do
|
40
|
-
puts "ERB::Util.html_escape"
|
37
|
+
x.report "ERB::Util.html_escape" do
|
41
38
|
times.times do
|
42
39
|
ERB::Util.html_escape(html)
|
43
40
|
end
|
44
41
|
end
|
45
42
|
|
46
|
-
x.report do
|
47
|
-
puts "CGI.escapeHTML"
|
43
|
+
x.report "CGI.escapeHTML" do
|
48
44
|
times.times do
|
49
45
|
CGI.escapeHTML(html)
|
50
46
|
end
|
51
47
|
end
|
52
48
|
|
53
|
-
x.report do
|
54
|
-
puts "fast_xs_extra#fast_xs_html"
|
49
|
+
x.report "fast_xs_extra#fast_xs_html" do
|
55
50
|
times.times do
|
56
51
|
html.fast_xs_html
|
57
52
|
end
|
58
53
|
end
|
59
54
|
|
60
|
-
x.report do
|
61
|
-
puts "EscapeUtils.escape_html"
|
55
|
+
x.report "EscapeUtils.escape_html" do
|
62
56
|
times.times do
|
63
57
|
EscapeUtils.escape_html(html)
|
64
58
|
end
|
data/benchmark/html_unescape.rb
CHANGED
@@ -20,15 +20,13 @@ escaped_html = EscapeUtils.escape_html(html)
|
|
20
20
|
puts "Unescaping #{escaped_html.bytesize} bytes of escaped html #{times} times, from #{url}"
|
21
21
|
|
22
22
|
Benchmark.bmbm do |x|
|
23
|
-
x.report do
|
24
|
-
puts "CGI.unescapeHTML"
|
23
|
+
x.report "CGI.unescapeHTML" do
|
25
24
|
times.times do
|
26
25
|
CGI.unescapeHTML(escaped_html)
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
|
-
x.report do
|
31
|
-
puts "EscapeUtils.unescape_html"
|
29
|
+
x.report "EscapeUtils.unescape_html" do
|
32
30
|
times.times do
|
33
31
|
EscapeUtils.unescape_html(escaped_html)
|
34
32
|
end
|
@@ -18,15 +18,13 @@ javascript = `curl -s #{url}`
|
|
18
18
|
puts "Escaping #{javascript.bytesize} bytes of javascript #{times} times, from #{url}"
|
19
19
|
|
20
20
|
Benchmark.bmbm do |x|
|
21
|
-
x.report do
|
22
|
-
puts "ActionView::Helpers::JavaScriptHelper#escape_javascript"
|
21
|
+
x.report "ActionView::Helpers::JavaScriptHelper#escape_javascript" do
|
23
22
|
times.times do
|
24
23
|
ActionPackBench.escape_javascript(javascript)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
|
-
x.report do
|
29
|
-
puts "EscapeUtils.escape_javascript"
|
27
|
+
x.report "EscapeUtils.escape_javascript" do
|
30
28
|
times.times do
|
31
29
|
EscapeUtils.escape_javascript(javascript)
|
32
30
|
end
|
@@ -14,8 +14,7 @@ escaped_javascript = EscapeUtils.escape_javascript(javascript)
|
|
14
14
|
puts "Escaping #{escaped_javascript.bytesize} bytes of javascript #{times} times, from #{url}"
|
15
15
|
|
16
16
|
Benchmark.bmbm do |x|
|
17
|
-
x.report do
|
18
|
-
puts "EscapeUtils.escape_javascript"
|
17
|
+
x.report "EscapeUtils.escape_javascript" do
|
19
18
|
times.times do
|
20
19
|
EscapeUtils.unescape_javascript(escaped_javascript)
|
21
20
|
end
|
data/benchmark/url_escape.rb
CHANGED
@@ -17,43 +17,37 @@ url = "https://www.yourmom.com/cgi-bin/session.cgi?sess_args=mYHcEA dh435dqUs0m
|
|
17
17
|
puts "Escaping a #{url.bytesize} byte URL #{times} times"
|
18
18
|
|
19
19
|
Benchmark.bmbm do |x|
|
20
|
-
x.report do
|
21
|
-
puts "ERB::Util.url_encode"
|
20
|
+
x.report "ERB::Util.url_encode" do
|
22
21
|
times.times do
|
23
22
|
ERB::Util.url_encode(url)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
x.report do
|
28
|
-
puts "Rack::Utils.escape"
|
26
|
+
x.report "Rack::Utils.escape" do
|
29
27
|
times.times do
|
30
28
|
Rack::Utils.escape(url)
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
|
-
x.report do
|
35
|
-
puts "CGI.escape"
|
32
|
+
x.report "CGI.escape" do
|
36
33
|
times.times do
|
37
34
|
CGI.escape(url)
|
38
35
|
end
|
39
36
|
end
|
40
37
|
|
41
|
-
x.report do
|
42
|
-
puts "URLEscape#escape"
|
38
|
+
x.report "URLEscape#escape" do
|
43
39
|
times.times do
|
44
40
|
URLEscape.escape(url)
|
45
41
|
end
|
46
42
|
end
|
47
43
|
|
48
|
-
x.report do
|
49
|
-
puts "fast_xs_extra#fast_xs_url"
|
44
|
+
x.report "fast_xs_extra#fast_xs_url" do
|
50
45
|
times.times do
|
51
46
|
url.fast_xs_url
|
52
47
|
end
|
53
48
|
end
|
54
49
|
|
55
|
-
x.report do
|
56
|
-
puts "EscapeUtils.escape_url"
|
50
|
+
x.report "EscapeUtils.escape_url" do
|
57
51
|
times.times do
|
58
52
|
EscapeUtils.escape_url(url)
|
59
53
|
end
|
data/benchmark/url_unescape.rb
CHANGED
@@ -17,36 +17,31 @@ escaped_url = EscapeUtils.escape_url(url)
|
|
17
17
|
puts "Escaping a #{url.bytesize} byte URL #{times} times"
|
18
18
|
|
19
19
|
Benchmark.bmbm do |x|
|
20
|
-
x.report do
|
21
|
-
puts "Rack::Utils.unescape"
|
20
|
+
x.report "Rack::Utils.unescape" do
|
22
21
|
times.times do
|
23
22
|
Rack::Utils.unescape(escaped_url)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
x.report do
|
28
|
-
puts "CGI.unescape"
|
26
|
+
x.report "CGI.unescape" do
|
29
27
|
times.times do
|
30
28
|
CGI.unescape(escaped_url)
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
|
-
x.report do
|
35
|
-
puts "URLEscape#unescape"
|
32
|
+
x.report "URLEscape#unescape" do
|
36
33
|
times.times do
|
37
34
|
URLEscape.unescape(escaped_url)
|
38
35
|
end
|
39
36
|
end
|
40
37
|
|
41
|
-
x.report do
|
42
|
-
puts "fast_xs_extra#fast_uxs_cgi"
|
38
|
+
x.report "fast_xs_extra#fast_uxs_cgi" do
|
43
39
|
times.times do
|
44
40
|
url.fast_uxs_cgi
|
45
41
|
end
|
46
42
|
end
|
47
43
|
|
48
|
-
x.report do
|
49
|
-
puts "EscapeUtils.unescape_url"
|
44
|
+
x.report "EscapeUtils.unescape_url" do
|
50
45
|
times.times do
|
51
46
|
EscapeUtils.unescape_url(escaped_url)
|
52
47
|
end
|
data/lib/escape_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: escape_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Lopez
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-25 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
requirements: []
|
202
202
|
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 1.
|
204
|
+
rubygems_version: 1.3.7
|
205
205
|
signing_key:
|
206
206
|
specification_version: 3
|
207
207
|
summary: Faster string escaping routines for your web apps
|