Skip to content

Commit

Permalink
import templates beforehands
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Feb 12, 2025
1 parent 0ae79b1 commit eb01611
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/benchmarks/test_compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@
from reflex.components.component import Component


def import_templates():
# Importing the templates module to avoid the import time in the benchmark
import reflex.compiler.templates # noqa: F401


def test_compile_page(evaluated_page: Component, benchmark: BenchmarkFixture):
import_templates()

benchmark(lambda: _compile_page(evaluated_page, None))


def test_compile_stateful(evaluated_page: Component, benchmark: BenchmarkFixture):
import_templates()

benchmark(lambda: _compile_stateful_components([evaluated_page]))


Expand Down

0 comments on commit eb01611

Please sign in to comment.