Found the actual performance problem finally.

It's fast as lightning now.