Optimize recommendation calculation