<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Jesper Louis Andersen" <jesper.louis.andersen@gmail.com><br><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 22, 2013 at 8:55 PM, Steve Vinoski <span dir="ltr"><<a href="mailto:vinoski@ieee.org" target="_blank">vinoski@ieee.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.</blockquote></div><br>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.</div></div></blockquote><div><br></div><div>It is faster and deterministic for any RE which needs backtracking; PCRE can backtrack into oblivion. There should definitely be an re2 module. It should be easier to implement as you don't have to worry about ensuring it doesn't block too long.<br></div><div><br></div><div>Robert<br></div><div><br></div></div></body></html>