First, use cache only if you have both : xsell and enabled/disabled categories.
I added the cache system because i didn't have enough time to make the sql query nicely and quickly and these 2 contribs have already been installed by someone else.
So, don't install cache if you don't use enabled/disabled categories (comment lines //cache).
If you use it, and you have enough time to increase the slow sql query, it'll be better !
do it and update me :-"
In fact, if you use enable/disabled categories, one where in sql query is missing : "where c.categories_status='1'" and a left join onto "TABLE_CATEGORIES".
I hope this will help you. I'll try to check code, but at this moment i've a lot a work, so i can't promise something.