Thanks for looking into that. The attached patches solve those performance problems for me.