Finding the slow part
Why it matters When training is slow, the cause is nearly always one line. Measure before you change anything.
A profiler runs your program and reports how long each line took. The rule that almost always holds: one or two lines take most of the time, and speeding up anything else is wasted effort.
Tiny numbers
If a run takes 10 seconds and one line takes 8 of them, making every other line infinitely fast saves only 2 seconds. Making that one line twice as fast saves 4.
Profiler: a tool that measures where a program spends its time.
Recap Find the biggest number first. Fix that, then measure again.
profile maps each line of a training script to the seconds it took. Write slowest(profile) that returns a pair: the slowest line, and its share of the total time as a fraction (0 to 1).
Spotted a problem in this lesson? Report it · Ask about this lesson
This exercise opens soon
Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.
This browser is blocking cookies for learn.floati.life, so lessons you finished here cannot open in order. Allow cookies for this site and reload.