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
@@ -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() ->