This performance regression was fixed by commit 517d03e4 (#12234). Let's add a performance test to ensure that it doesn't break again.