[erlang-questions] Maps branch and disclaimers
Tomas Abrahamsson
tomas.abrahamsson@REDACTED
Sat Oct 26 01:53:04 CEST 2013
> Here you go, Maps!
>
> I've pushed a Maps branch to Erlang/OTPs repository at GitHub.
Hi, this is cool!
I did some performance experiments with gpb, a google
protobuf encoder/decoder, in which I had already implemented
experimental support for maps. It seems map creation is fast!
representation of msg
records maps
msg to binary: 27.6 MB/s 22.9 MB/s (83% of record speed)
binary to msg: 27.3 MB/s 29.9 MB/s (110% of record speed)
The figures are number of megabytes processed per second, so
higher number means faster/better. The "binary to msg" involves
creating a record or map, with several fields, once for each
parsed message or sub message. The "msg to binary" uses a match
for several message fields to assign each field to a variable,
once for each message or sub message to encode. Included in
these figures is of course also some binary processing.
I also stumbled upon an what appears to be a compiler error.
Given this program:
-module(mapbug).
-export([verify_msg/1]).
verify_msg(Msg) ->
v_msg_m1(Msg).
v_msg_m1(#{f2 := F2}) ->
if is_list(F2) -> [v_type_uint32(Elem) || Elem <- F2];
true -> ok
end,
ok;
v_msg_m1(_X) ->
ok.
v_type_uint32(_N) ->
ok.
compiling it results in:
1> c("/path/to/mapbug", []).
mapbug: function v_msg_m1/1+17:
Internal consistency check failed - please report this bug.
Instruction: return
Error: {stack_frame,undecided}:
error
BRs
Tomas
More information about the erlang-questions
mailing list