Efficiently get all tags through the API

Hi guys, is there an efficient way to get every tag across an entire vault through the API? Currently I check every note for tags and then add the tags to a set, but I feel like this is really inefficient.

Thanks for any suggestions.

I couldn’t find any other way, so I get the tags from each file’s metadata and create a set, as you do. Make sure to get the tags from the cache metadata, not parsing the file.