[erlang-questions] unpacking big/little endian speed difference
Tue Oct 13 16:31:05 CEST 2015
On 10/13/2015 02:59 PM, Sergej Jurečko wrote:
> How come unpacking integers as big endian is faster than little endian,
> when I'm running on a little endian platform (intel osx)?
> I know big endian is erlang default, but if you're turning binaries into
> integers, you must turn them into little endian anyway, so unpacking
> should basically be memmcpy.
> The test:
> % Takes: ~1.3s
> % Takes: ~1.8s
> % -define(ENDIAN,unsigned-little).
Well, if you are interested in performance, simply compile to native
code your module and the time will drop to less than half...
Eshell V7.1 (abort with ^G)
6> c(endian, [native]).
More information about the erlang-questions