So i'm using Python, i'm not new to Python, but obviously not advanced. Anyway, i have an algorithm that i want to implement using Python, but I want to make it as quick as possible. My question is: can we find a benchmark comparing most operations but with different "codes"? For example, if i have a list and i want to divide all elements by 2, there are multiple ways to code it
newlist=[e/2 for e in oldlist]
or using a loop
newlist=[] for e in oldlist: newlist.append(e/2)
or even using a library (scipy, numpy etc...). Which way to code this is the fastest? This is a simple example but there are so many operations i don't know which way to code it is the best, and i may not now every way to code it either...
So i ask the question for Python, but it is also a viable question for other programming languages