Consider the following Python program that performs a lot of disk writing in a for loop:
from time import clock
import os
import sqlite3
data = sqlite3.connect('data.db')
t0 = clock()
with open("data.json") as f:
for line in f:
do some operations
do some sqlite queries
print(clock()-t0)
Why does the time displayed by print(clock()-t0)
does not correspond to the real elapsed time ? It underestimates the elapsed time by a factor ~4.