I see. If performance is a significant bottleneck you can directly use the underlying C++ class. See CompiledSubdomain using C++ class in case if you haven’t already. You can view the complete list of methods at Bitbucket. Though map
and inside
are the only relevant methods that you may need.
Edit: I haven’t done that myself yet. But should be straightforward given that you have already gotten the idea correct. If I get some time, I can make a simple MWE.