[erlang-questions] any way to speed up regex.split?
Peter Hickman
peterhickman386@REDACTED
Sun Dec 22 13:37:57 CET 2013
The Ruby version can be improved slightly by making the regex it's own
object. On my system (1.9.2) the times dropped from
1.750000 0.010000 1.760000 ( 1.758900)
to
1.470000 0.010000 1.480000 ( 1.473895)
require 'benchmark'
n = 50000
re = /\s+/
text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum."
puts Benchmark.measure { n.times { text.split re } }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131222/c68eca2f/attachment.htm>
More information about the erlang-questions
mailing list