ETS 运营运行时
ETS Operations Runtime
ets 包 delete_object
的运行时间是多少?鉴于有 n
个条目具有相同的键 k
,delete_object
的运行时间会是 O(n)
还是 O(1)
?如果确实是O(1)
,lookup
操作如何return所有元组按插入时间排序?
谢谢!
erlang 邮件列表上的这个 post 是 2011 年的,但我认为它可能仍然有效:
http://erlang.org/pipermail/erlang-questions/2011-October/061705.html
Sverker Eriksson 给出的答案暗示查找时间将是 O(n)
wrt 相等键的数量:
On average constant time for insert/lookup/removal of scattered keys. A
bag with lots of identical keys may give bad performance as that will
result in linear searches between objects with the same key (and others
that happen to hash to the same bucket).
ets 包 delete_object
的运行时间是多少?鉴于有 n
个条目具有相同的键 k
,delete_object
的运行时间会是 O(n)
还是 O(1)
?如果确实是O(1)
,lookup
操作如何return所有元组按插入时间排序?
谢谢!
erlang 邮件列表上的这个 post 是 2011 年的,但我认为它可能仍然有效:
http://erlang.org/pipermail/erlang-questions/2011-October/061705.html
Sverker Eriksson 给出的答案暗示查找时间将是 O(n)
wrt 相等键的数量:
On average constant time for insert/lookup/removal of scattered keys. A bag with lots of identical keys may give bad performance as that will result in linear searches between objects with the same key (and others that happen to hash to the same bucket).