1import time 2 3 4def draw(): 5 py5.stroke(py5.random_int(255), py5.random_int(255), py5.random_int(255)) 6 # this should use `points` instead 7 for _ in range(100): 8 py5.point(py5.random_int(py5.width), py5.random_int(py5.height)) 9 10 11py5.profile_draw() 12py5.run_sketch() 13 14 15# let the sketch run for a bit to accumulate data 16time.sleep(10) 17 18py5.print_line_profiler_stats()
Print the line profiler stats initiated with profile_draw() or profile_functions(). The collected stats will include the number of times each line of code was executed (Hits) and the total amount of time spent on each line (Time). This information can be used to target the performance tuning efforts for a slow Sketch.
This method can be called multiple times on a running Sketch.
print_line_profiler_stats() -> None
Updated on September 11, 2021 16:51:34pm UTC