-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* benchmark experimentation * do the same for test_evaluate_page * import templates beforehands * add auto reload * disable extensions
- Loading branch information
1 parent
dd5b817
commit d79366d
Showing
4 changed files
with
29 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
import pytest | ||
from pytest_codspeed import BenchmarkFixture | ||
|
||
from reflex.compiler.compiler import _compile_page, _compile_stateful_components | ||
from reflex.components.component import Component | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_compile_page(evaluated_page): | ||
_compile_page(evaluated_page, None) | ||
def import_templates(): | ||
# Importing the templates module to avoid the import time in the benchmark | ||
import reflex.compiler.templates # noqa: F401 | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_compile_stateful(evaluated_page): | ||
_compile_stateful_components([evaluated_page]) | ||
def test_compile_page(evaluated_page: Component, benchmark: BenchmarkFixture): | ||
import_templates() | ||
|
||
benchmark(lambda: _compile_page(evaluated_page, None)) | ||
|
||
@pytest.mark.benchmark | ||
def test_get_all_imports(evaluated_page): | ||
evaluated_page._get_all_imports() | ||
|
||
def test_compile_stateful(evaluated_page: Component, benchmark: BenchmarkFixture): | ||
import_templates() | ||
|
||
benchmark(lambda: _compile_stateful_components([evaluated_page])) | ||
|
||
|
||
def test_get_all_imports(evaluated_page: Component, benchmark: BenchmarkFixture): | ||
benchmark(lambda: evaluated_page._get_all_imports()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import pytest | ||
from typing import Callable | ||
|
||
from pytest_codspeed import BenchmarkFixture | ||
|
||
@pytest.mark.benchmark | ||
def test_evaluate_page(unevaluated_page): | ||
unevaluated_page() | ||
from reflex.components.component import Component | ||
|
||
|
||
def test_evaluate_page( | ||
unevaluated_page: Callable[[], Component], benchmark: BenchmarkFixture | ||
): | ||
benchmark(unevaluated_page) |