개발/Python

Python runtime measurement

강서버 2021. 6. 11. 10:29
728x90
반응형

1. time

import time

 

start = time.time()

 

(code)

 

print("time :", time.time() - start)

------------------------------------------------------------------------

time : 59.317203998565674

 

2. time, numpy(round())

import time

import numpy as np

 

start = time.time()

 

(code)

 

print("time :", np.round(time.time() - start), "(s)")

------------------------------------------------------------------------

time : 59.0 (s)

 

or

 

print("time :", np.round(time.time() - start, 2), "(s)")

------------------------------------------------------------------------

time : 59.32 (s)

 

728x90
반응형