https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78113
--- Comment #5 from Nir Friedman <quicknir at gmail dot com> --- Jonathan, I saw you just change the status of this. Michael Park's and I work has resulted in a different implementation of std::visit which has much better codegen; also backed by performance numbers. This also improves perf for things like comparison, since internally this uses the same mechanisms. We've actually been trying to contact someone from clang and gcc standard libraries about this for a while to no success... please feel free to email me at quick...@gmail.com to get the convo going about how to maybe merge some of that code in. Happy to help with the actual merging work as well.