Skip to content

Commit

Permalink
Log execution time of scene rendering in the Manim Checkhealth command (
Browse files Browse the repository at this point in the history
ManimCommunity#3855)

* Log execution time of scene rendering in the Manim Checkhealth command

* Use timeit.timeit instead of time.time for more reliable profiling
  • Loading branch information
chopan050 committed Jul 13, 2024
1 parent 1df1709 commit 3a71411
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions manim/cli/checkhealth/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
from __future__ import annotations

import sys
import timeit

import click
import cloup

from .checks import HEALTH_CHECKS
from manim.cli.checkhealth.checks import HEALTH_CHECKS

__all__ = ["checkhealth"]

Expand Down Expand Up @@ -62,7 +63,7 @@ def checkhealth():
import manim as mn

class CheckHealthDemo(mn.Scene):
def construct(self):
def _inner_construct(self):
banner = mn.ManimBanner().shift(mn.UP * 0.5)
self.play(banner.create())
self.wait(0.5)
Expand All @@ -79,5 +80,11 @@ def construct(self):
mn.FadeOut(text_tex_group, shift=mn.DOWN),
)

def construct(self):
self.execution_time = timeit.timeit(self._inner_construct, number=1)

with mn.tempconfig({"preview": True, "disable_caching": True}):
CheckHealthDemo().render()
scene = CheckHealthDemo()
scene.render()

click.echo(f"Scene rendered in {scene.execution_time:.2f} seconds.")

0 comments on commit 3a71411

Please sign in to comment.