summaryrefslogtreecommitdiff
path: root/etc/compare-token-variants.rb
diff options
context:
space:
mode:
Diffstat (limited to 'etc/compare-token-variants.rb')
-rw-r--r--etc/compare-token-variants.rb33
1 files changed, 0 insertions, 33 deletions
diff --git a/etc/compare-token-variants.rb b/etc/compare-token-variants.rb
deleted file mode 100644
index a4edd83..0000000
--- a/etc/compare-token-variants.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-require "benchmark"
-require "strscan"
-
-TESTS = 2_000_000
-S = 'begin ' * TESTS
-r = /begin /
-
-len = nil
-Benchmark.bm 20 do |results|
- results.report 'string' do
- s = StringScanner.new S
- a = []
- while matched = s.scan(r)
- a << [matched, :test]
- end
- end
- results.report 'length' do
- s = StringScanner.new S
- a = []
- while len = s.skip(r)
- a << [len, :test]
- end
- end
- results.report 'two arrays' do
- s = StringScanner.new S
- a = []
- b = []
- while matched = s.scan(r)
- a << len
- b << :test
- end
- end
-end \ No newline at end of file