[erlang-questions] Fast binary reverse

Ward Bekker ward@REDACTED
Thu Oct 27 12:11:29 CEST 2011

Hi Michael,

Yes, Funs will give overhead. Badly chosen example code on my part.

But still the rev2 example is on my machine still twice or trice as slow (YMMV) than a list:reverse. 

I want to see what can be done to bring a binary reverse on par with a list reverse. I would, naïvely, expect a binary reverse to be faster than a erlang list reverse.




From: Michael Uvarov [mailto:freeakk@REDACTED]
To: Ward Bekker [mailto:ward@REDACTED]
Sent: Thu, 27 Oct 2011 10:33:12 +0200
Subject: Re: [erlang-questions] Fast binary reverse

Just don't use anonymous functions.
  -export([rev1/1, rev2/1]).
  rev1(B) ->
      S = size(B)*8,
  rev2(B) ->
  29>  timer:tc(bin,rev2,[<<"teribly">>]).
  30>  timer:tc(bin,rev1,[<<"teribly">>]).
  Best regards,
  Uvarov Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111027/eb6eddac/attachment.htm>

More information about the erlang-questions mailing list