Reputation: 2333
I use ETS table of type ordered_set
, and row looks like {{integer_value, string}}
(basically it has no value, only key).
When I perform ets:select(tab, [match_spec])
, what match_spec
does is selecting all rows, where integer_value
meets greater than and lower than comprehensions.
I wonder, do I benefit and instead of scanning whole table, find both lower and upper bounds in logarithmic time and then get all elements in between, like I would expect from SQL table, or such functionality is not implemented in ETS and there is no particular benefit from using ordered_set
instead of ordinary set
?
Upvotes: 1
Views: 76
Reputation: 1626
Simple way is using timer:tc/3 function for getting execution time of your functions or ets module's functions.
You can profile your code using fprof or eprof for undestanding what function called and how much time it takes for its execution.
This can help you.
If you are not familiar with erlang profilers, i can show simple example of ets set
and ordered_set
with profilers.
Upvotes: 1