mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Add simple function to measure runtime
This commit is contained in:
parent
bafc8c88d5
commit
6be41fec6d
1 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import time
|
||||||
|
|
||||||
from manimlib.constants import BLACK
|
from manimlib.constants import BLACK
|
||||||
from manimlib.mobject.numbers import Integer
|
from manimlib.mobject.numbers import Integer
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
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)
|
label.set_stroke(BLACK, 5, background=True)
|
||||||
labels.add(label)
|
labels.add(label)
|
||||||
return labels
|
return labels
|
||||||
|
|
||||||
|
|
||||||
|
def get_runtime(func):
|
||||||
|
now = time.time()
|
||||||
|
func()
|
||||||
|
return time.time() - now
|
||||||
|
|
Loading…
Add table
Reference in a new issue