import time


def timeit(f, size, db):
    """
    Measure running time of the given function
    """
    start = time.time_ns()

    for i in range(size):
        f(db, i)

    end = time.time_ns()

    return int((end - start) / 1000)