Erlang标准数据结构的选择

Erlang标准数据结构的选择

(金庆的专栏)

gen_server with a dict vs mnesia table vs ets
http://stackoverflow.com/questions/2154376/gen-server-with-a-dict-vs-mnesia-table-vs-ets
给出一个按应用类型选择的方法:

Multiple processes on multiple VMs -> mnesia
Multiple processes on one VM -> ets/dets
One process -> bag/dict/...

Frequently Asked Questions about Erlang
February 22 2011
6.2  Is there a collection of data structures, e.g. balanced trees?
http://ftp.sunet.se/pub/lang/erlang/faq/libraries.html#id55214
旧版FAQ中有以下说明:

In practice, Erlang programs use lists (either natively or via dict) for data structures involving up to a few hundred elements and use ETS (the Erlang Term Store) or mnesia for anything larger. ETS uses hashing to allow near constant-time access to almost arbitrarily large amounts of data.

For a collection of data consisting of a few (tens or hundreds) items, lists often outperform both ETS and trees. For large numbers of small items, ETS tends to work best. For larger items, balanced trees can outperform ETS because they avoid copying the data.

但是新版FAQ中删除了以上这些说明,估计新版本中有了变化?

Frequently Asked Questions about Erlang
April 20 2015
6.2  Is there a collection of data structures, e.g. balanced trees?
http://www.erlang.org/faq/libraries.html#idp33085264

Erlang开发建议(杂记版)
http://erlangdisplay.iteye.com/blog/374167
给出了根据规模选择的范围,应该是按旧版FAQ作出的:
Suggestion:
elments count: 0 - 100 | 100 - 10000  |  10000 -
our select   :  list   |      ets     |  gb_tree


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值