[erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends
Max Lapshin
max.lapshin@REDACTED
Mon Apr 30 20:50:53 CEST 2012
Shame on me! I always thought that Erlang VM doesn't use intermediate
integers =(((
So perhaps it is possible to produce some really efficient code for
arithmetic that uses proper bit operations for integers!
> Well, when numbers are small enough (60 or 28 bits depending on if it's full
> word 64-bit or not, see ./erts/emulator/beam/erl_term.h) they are stored as
> immediate fixnums, and the match context shouldn't have much overhead
> either. I have no doubt that it's significantly slower than good C code, but
> maybe it's better than the combination of binary_to_list/1 and
> list_to_integer/1 BIFs.
>
> -bob
>
More information about the erlang-questions
mailing list