These are general tips that in general improve performance. If your code is slow, it is always important to profile it to figure out what parts are slow. Guessing is never enough. Improving the execution speed of something that only takes up 1% of the execution time probably isn't worth the effort. ...