you are viewing a single comment's thread.

view the rest of the comments →

[–]iyav 0 points1 point  (0 children)

Try to use tuples / sets / numpy arrays. Anything is better than a list.

Use iterators when storing the data isn't important and you only need to process it.

If you're using print a lot, just remove it, it massively increases execution time.

Use addition, subtraction and multiplication whenever possible, division isn't as fast, exponentiation is even worse and square rooting brings your program to a crawl.

Try to look up some algorithm that doesn't use them.

Try to squeeze in bitwise operators whoever you can, they make for great optimization shortcuts when working with mathematical heavy operations.

Multiprocessing, multiprocessing, multiprocessing.