It looks like you're trying to time your own code and not using this in a production release. For this kind of situation, it's almost always better to use someone else's timing mechanism. For python, that's timeit:
import timeit
#Save the code you want to test beforehand and import it in timeit
timer = timeit.Timer("mymodule.myfunc('input')", "import mymodule")
#You want the fastest time, not the average.
#Your system will theoretically execute code at the same rate each time
#It doesn't because of other processes,
#so get the run with the least interference
print min(timer.repeat())
This will run your code 1,000,000 times, 3 times, and print the minimum value, all while using an accurate timing mechanism. Pretty cool, huh? You can also specify lower or higher runs and repeats:
print min(timer.repeat(repeat=5, number=2000000))
print min(timer.repeat(repeat=3, number=1000))
If you want to see what specifically needs speeding up, try profile or cProfile (cProfile being less tested because it's newer, but theoretically better.)
Cheers!