How to measure speed improvements across revisions over time?

M

Matthew Wilson

I know how to use timeit and/or profile to measure the current run-time
cost of some code.

I want to record the time used by some original implementation, then
after I rewrite it, I want to find out if I made stuff faster or slower,
and by how much.

Other than me writing down numbers on a piece of paper on my desk, does
some tool that does this already exist?

If it doesn't exist, how should I build it?

Matt
 
S

Steven D'Aprano

I know how to use timeit and/or profile to measure the current run-time
cost of some code.

I want to record the time used by some original implementation, then
after I rewrite it, I want to find out if I made stuff faster or slower,
and by how much.

Other than me writing down numbers on a piece of paper on my desk, does
some tool that does this already exist?

If it doesn't exist, how should I build it?


from timeit import Timer
before = Timer(before_code, setup)
after = Timer(after_code, setup)
improvement = min(before.repeat()) - min(after.repeat())
 
M

Martin v. Loewis

Matthew said:
I know how to use timeit and/or profile to measure the current run-time
cost of some code.

I want to record the time used by some original implementation, then
after I rewrite it, I want to find out if I made stuff faster or slower,
and by how much.

Other than me writing down numbers on a piece of paper on my desk, does
some tool that does this already exist?

I recommend to use rrd. This can record time series, and then generate
diagrams.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top