forked from comfy/active_link_to
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark.rb
More file actions
30 lines (24 loc) · 716 Bytes
/
benchmark.rb
File metadata and controls
30 lines (24 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/env ruby
#
# Run this benchmark by using command below
# bundle exec ruby benchmark.rb
#
require "active_support"
require "action_view"
require "simple_active_link_to"
require "benchmark/ips"
require_relative "test/mocks/fake_request"
require_relative "test/mocks/fake_capture"
SimpleActiveLinkTo.include FakeRequest
SimpleActiveLinkTo.include FakeCapture
class Klass
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include SimpleActiveLinkTo
end
klass = Klass.new
klass.set_path "/root"
Benchmark.ips do |x|
x.report("simple_active_link_to") { klass.simple_active_link_to("test", "/test") }
x.report("is_active_link?") { klass.is_active_link?("/test") }
end