Currently, I'm using Y mechanism, and it produces correct results.
However, the performance sucks -- profiling shows me this is a big time sink in my program. So... (actual question.)
It may help with kneejerk "premature optimization" if the profiler results are mentioned before the request about how to optimize (at least, it should to the extent that the problem is people stopping reading because they see the optimization request so that they never read the comment about profiler results.)
> I'm optimizing this due to profiler results.
You'd be surprised how many people still question whether I'm prematurely optimizing in the comments, but the actual answers tend to be more helpful.