Testing volume for specific block types

Is there a better way of testing a volume of blocks for a specific block type other than testing every position? The use case is making an "ore detector" item that beeps if the player is near an ore. My current idea is to take advantage of how ore veins generate in blobs to space out a grid of somewhat-optimally arranged markers to reduce the number of tests needed.

Continue to help post