From 6be41fec6d9e62a242fc3e2309ae18f8aeabd0ac Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 20 Feb 2020 16:50:13 -0800 Subject: [PATCH] Add simple function to measure runtime --- manimlib/utils/debug.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/manimlib/utils/debug.py b/manimlib/utils/debug.py index 28f8f1ad..2d119a0c 100644 --- a/manimlib/utils/debug.py +++ b/manimlib/utils/debug.py @@ -1,3 +1,5 @@ +import time + from manimlib.constants import BLACK from manimlib.mobject.numbers import Integer from manimlib.mobject.types.vectorized_mobject import VGroup @@ -19,3 +21,9 @@ def get_submobject_index_labels(mobject, label_height=0.15): label.set_stroke(BLACK, 5, background=True) labels.add(label) return labels + + +def get_runtime(func): + now = time.time() + func() + return time.time() - now