Since the detection is a one time deal it's just a matter of putting it in its own subpatch and using switch~ to turn it off after mapping the hits.
An even more sophisticated way of doing it would be to then to save the hits map to the disc using the sample's MD5 hash as a reference. That way if that file exists just load it instead of detecting the hits, if not detect the hits and save it.
By using the MD5 rather than the filename you guarantee that any changes done to the original file force re-detection by the patch. Another side effect is that you might have the same file copied with different names and they will still have the same MD5.
Don't think there is an md5 object in pd. I'll whip one up later.