Sha256: e7a29aaf1745bc1ad724f901850cb302a76be91e3e92e47d1172438eba95a41e
Contents?: true
Size: 395 Bytes
Versions: 13
Compression:
Stored size: 395 Bytes
Contents
require "strscan" require_relative "../lib/zscan" require "benchmark" s = "word\n" s *= 3_000_000 puts "StringScanner:" sc = StringScanner.new s puts Benchmark.measure{ until sc.eos? sc.scan(/\w+/) and (sc.pos += 1) end } puts puts "ZScan should be nearly as fast as StringScanner" zc = ZScan.new s puts Benchmark.measure{ until zc.eos? zc.scan(/\w+/) and zc.advance(1) end }
Version data entries
13 entries across 13 versions & 1 rubygems