Improving the performance of R