[erlang-questions] binary optimization

Joel Reymont joelr1@REDACTED
Sat Jul 18 12:49:13 CEST 2009


On Jul 18, 2009, at 10:25 AM, Mikael Pettersson wrote:

> Get rid of the apply, i.e. the ?MODULE:Where call. That would be good
> for other performance reasons too.


This doesn't fly either...

src/flashbot.erl:117: Warning: NOT OPTIMIZED: sub binary is used or  
returned

handle_info({tcp, _Sock, <<A:32, B:32, C:32, Bin/binary>>}, Where,  
State) ->
     Delta = timer:now_diff(now(), {A, B, C}),
     Where(Bin, State#state{latency = Delta});

Also, what about this?

src/flashbot.erl:81: Warning: NOT OPTIMIZED: sub binary used by  
erlang:setelement/3

no_token(<<?TOKEN, _:32, Token/binary>>, State) ->
     send([?SUBSCRIBE, size(?TOPIC), ?TOPIC],
          State#state{token = Token},
          not_subscribed).

	Thanks, Joel

---
Mac hacker with a performance bent
http://www.linkedin.com/in/joelreymont



More information about the erlang-questions mailing list