Skip to content

Instantly share code, notes, and snippets.

@thiagofm
Created April 21, 2014 18:59
Show Gist options
  • Save thiagofm/11152778 to your computer and use it in GitHub Desktop.
Save thiagofm/11152778 to your computer and use it in GitHub Desktop.
betawaffle
3:53 thiagofm: well hold on
betawaffle
3:53 i can give you some pointers
3:53 don't copy the uglyness
3:54 erlang optimizing certain binary matching situations, and i exploit those to try to lose as little time as possible
3:55 you need the first argument in each matching function to be the binary you are matching
thiagofm
3:55 thats nice, i didn't know about it
betawaffle
3:55 and you can't return the binary if you want to keep the optimization through to the next call
3:56 so if you can stick to tail-recursive-only, that'd be best
3:56 tjsousa__ left the room (quit: Ping timeout: 252 seconds).
betawaffle
3:56 obviously sometimes you will have to return a value, as you are actually trying to parse something, rather than just reading over it :P
3:57 oh, and if you try to use a matched-out subbinary more than once, you also lose the optimization for that function head
3:58 you can get more info from http://www.erlang.org/doc/efficiency_guide/binaryhandling.html
3:58 You have disconnected
3:58 You have connected
3:58 The topic for #elixir-lang is: Elixir: http://elixir-lang.org | Programming Elixir: http://goo.gl/jytDk | Packages: http://expm.co | Run Elixir code in the channel as: !elixir> "Hello"
3:58 Topic for #elixir-lang set by [email protected] at 11:39:32 on 05/22/13
betawaffle
3:59 when compiling the module, it will log whether certain function heads were optimized or not
betawaffle
3:59 thiagofm: ^
thiagofm
3:59 betawaffle: ty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment