Speed#

from IPython.display import Markdown
from time import time

t1 = time()
from policyengine_us import Microsimulation

t2 = time()
sim = Microsimulation()
t3 = time()
sim.calc("spm_unit_benefits")
sim.calc("spm_unit_taxes")
t4 = time()

Markdown(
    f"The time to import `Microsimulation` from `policyengine_us` is {t2 - t1:.01f} seconds. The time to initialise a `Microsimulation` object is {t3 - t2:.01f} seconds, and the time to complete simulation of taxes and benefits is {t4 - t3:.01f} seconds."
)

The time to import Microsimulation from policyengine_us is 19.9 seconds. The time to initialise a Microsimulation object is 0.1 seconds, and the time to complete simulation of taxes and benefits is 35.5 seconds.