ETS Operation Performance

Hello everyone!

I know that this is not an erlang forum, but people here seem very knowledgeable about ets so I thought I would give this a try.

What is the runtime of delete_object for the ets :bag? Given that there are n entries with the same key k , would the runtime of delete_object/2 be O(n) or O(1) ? If it is indeed O(1) , how does the lookup/2 operation return all tuples sorted by insert time in constant time w.r.t the number of keys? Or is my assumption about the runtime of lookup/2 incorrect?

Thanks!

1 Like

I asked the same question in SO: https://stackoverflow.com/questions/51639007/ets-operations-runtime

TLDR: lots of entries with the same keys will degrade performance to O(n).

2 Likes