问题描述:

In joe's "Big changes to Erlang"

http://joearms.github.io/2014/02/01/big-changes-to-erlang.html

"we wanted maps to be a replacement for records and to be as efficient as records, and its not blindingly obvious how to do so."

How to make transform records to maps in mnesia?

网友答案:

Mnesia uses ETS (and dets) internally and these are based on tuples as the base data structure. While they can contain maps at the top-level it must be tuples. As records are tuples records can also be at the top-level. Redesigning ets/dets/mnesia to use maps would be a major effort.

As maps access is done dynamically while records statically it is probably not possible to get maps as fast as records.

相关阅读:
Top