[erlang-questions] Why is decode_packet so fast?

Sergey S <>
Sat Jan 17 22:22:43 CET 2009


Hello.

While I was reading about binaries and bit syntax, I decided to make
analogue of some standard function dealing with binaries. Just to
improve my understanding of how to use it right. My choice was
erlang:decode_packet/3.

At first I wrote my own decoder. But when I compared it with
decode_packet based decoder I saw the following:

1> http_decoder:test().
[{660,667},{210,215}]

The first tuple is time spent in my (rather unsophisticated) decoder,
the second one is time spent in function that uses decode_packet at
it's heart.

it appears that people who wrote decode_packet, made it really-really
fast. I noted how good decode_packet is and then tried to find out the
sources. But didn't find the implementation in
/usr/lib/erlang/lib/kernel-2.12.5/src/erlang.erl. So my attempt to
find out what made decode_packet so fast failed =)

Please, tell me where the implementation of decode_packet is placed.

--
Sergey



More information about the erlang-questions mailing list