[erlang-questions] any way to speed up regex.split?
Jesper Louis Andersen
jesper.louis.andersen@REDACTED
Mon Dec 23 00:53:24 CET 2013
On Sun, Dec 22, 2013 at 8:55 PM, Steve Vinoski <vinoski@REDACTED> wrote:
> You can gain a slight speedup by specifying [{return,binary}] as the final
> argument to re:split/3, but since you're splitting on whitespace, why not
> use binary:split rather than re:split? The former appears to be 10x faster
> than the latter for this case.
This would be my approach as well. I tend to avoid regular expression
parsing if I can. The speed of the regex library is probably quite
dependent on the underlying regex engine. I would think the Ruby engine
(Onigumuru IIRC) is faster than the nice PCRE engine Erlang uses. There are
also the RE2 variant which uses a Thompson NFA and is faster for many
problems. But it has no direct Erlang-implementation.
--
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131223/f6214578/attachment.htm>
More information about the erlang-questions
mailing list