金庆的专栏

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  423 随笔 :: 0 文章 :: 454 评论 :: 0 Trackbacks
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
posted on 2015-04-20 16:34 金庆 阅读(610) 评论(0)  编辑 收藏 引用 所属分类: 7. Erlang

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理