[erlang-questions] any way to speed up regex.split?

Steve Vinoski <>
Sun Dec 22 20:55:24 CET 2013


On Wed, Dec 18, 2013 at 2:06 PM, akonsu <> wrote:

> I have two benchmarks that perform a simple text split on a regular
> expression. One is in Ruby and another is in Erlang. The Erlang version is
> 6 times slower on my machine for some reason. I have read all documentation
> I could find on how to use binaries in Erlang, but I cannot make it faster.
> I am looking for help.
>

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.

--steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131222/ed816f39/attachment.html>


More information about the erlang-questions mailing list