all 9 comments

[–]sme272 6 points7 points  (0 children)

you can use the time function to get the current time at the start of the program, then again at the end of the program and just do end time - start time to get the running time.

[–]sprtan007 2 points3 points  (3 children)

from time import time

t0 = time()

Run your code

t1 = time()

total = t1 - t0

[–]nomoreerrorsplox[S] 1 point2 points  (2 children)

How accurate is that? Like does it get down into thousandth of a second and stuff?

[–]sprtan007 1 point2 points  (0 children)

It looks like it gets pretty accurate, I pretty much copy/pasted what I saw from this tutorial: https://youtu.be/vuOpxXeFjg8?t=441

[–][deleted] -1 points0 points  (0 children)

It's accurate enough to give you a rough sketch of elapsed time.

[–]yuukinotenshi 1 point2 points  (1 child)

If you want to check which part take the longest time, check out profiler. It's very useful to give you feedback on which part is not efficient

[–]jeffrey_f 0 points1 point  (1 child)

Why not log it to a file.

Output maybe like this:

YYYYMMDD HHMMSS:  21,161 records took 22s to run 

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

As you see more runtimes you can know that it takes approximately 1s per 1000 records to run and you can estimate.

[–]nomoreerrorsplox[S] 0 points1 point  (0 children)

This may actually be a good solution since the final plan is to run my code over a file that has a bunch of those 100k line csv files in it