How to use timeit when timing a function

前端 未结 5 1792
南旧
南旧 2020-12-16 16:41

Let me start off by saying I know almost nothing about python but have to write a program in three different languages (already done in java and c++).

I need to be a

5条回答
  •  遥遥无期
    2020-12-16 17:41

    yes well, just time it.

    ex

    total= 0
    for i in range(1000):
        start= time.clock()
        function()
        end= time.clock()
        total += end-start
    time= total/1000
    

提交回复
热议问题