perf(trie): do not call ets:info/2 to check if table is empty
emqx_trie table is a ordered_set, with write_concurrency set to true, the counter is not centrialsed, the ets:info/2 call to check size == 0 is very expensive
This commit is contained in:
parent
cfec4c9690
commit
c81cd8550d
|
@ -122,7 +122,7 @@ match(Topic) when is_binary(Topic) ->
|
|||
|
||||
%% @doc Is the trie empty?
|
||||
-spec(empty() -> boolean()).
|
||||
empty() -> ets:info(?TRIE, size) == 0.
|
||||
empty() -> ets:first(?TRIE) =:= '$end_of_table'.
|
||||
|
||||
-spec lock_tables() -> ok.
|
||||
lock_tables() ->
|
||||
|
|
Loading…
Reference in New Issue