perf_counter

mail@pastecode.io avatar
unknown
plain_text
2 years ago
256 B
1
Indexable
Never
##Measuring performance of code

import time

def sum_up_to(n):
    sum = 0

    for number in range(1, n + 1):
            sum = sum + number

    return sum

start = time.perf_counter()
print(sum_up_to(125555))
end = time.perf_counter()
print(end-start)