Skip to content

Commit 6a5cd26

Browse files
committed
add text profiles to pdf instead of svg
1 parent 8ea00c1 commit 6a5cd26

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
TyperCommand TyperCommand
3+
BaseCommand TyperCommand (rich) --help (rich)
4+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5+
modules 550 592 745 746
6+
time 0.16 0.17 0.24 0.22
7+
imports 0.10 0.12 0.16 0.17
8+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
polls
3+
polls polls --help shell
4+
polls --help polls shell (typer (typer completion
5+
(tutorial) (tutorial) (typer) completi… w/rich) w/rich) (rich)
6+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
7+
modules 573 551 615 606 768 747 755
8+
time 0.15 0.15 0.17 0.20 0.24 0.22 0.27
9+
imports 0.11 0.10 0.12 0.12 0.16 0.15 0.15
10+

doc/source/performance.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ improvements <https://github.com/django-commons/django-typer/issues/170>`_ are m
3737

3838
.. only:: latex
3939

40-
.. image:: _static/img/minimal_profile.svg
41-
:width: 80%
40+
.. literalinclude:: _static/img/minimal_profile.txt
4241

4342
The second benchmark shows the same stats for the :ref:`polls example code <building_commands>`.
4443
These benchmarks compare the :class:`~django.core.management.BaseCommand` native implementation
@@ -54,5 +53,4 @@ using :pypi:`django-typer` is minimal. On the order of a few 10s of milliseconds
5453

5554
.. only:: latex
5655

57-
.. image:: _static/img/polls_profile.svg
58-
:width: 80%
56+
.. literalinclude:: _static/img/polls_profile.txt

profiling/profile.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,13 @@ def minimal_table():
420420
Path(__file__).parent.parent / "doc/source/_static/img/minimal_profile.svg"
421421
).write_text(svg, encoding="utf-8")
422422

423+
console.print(table)
424+
425+
svg = console.export_text() # export as a string
426+
(
427+
Path(__file__).parent.parent / "doc/source/_static/img/minimal_profile.txt"
428+
).write_text(svg, encoding="utf-8")
429+
423430
def polls_table():
424431
console = Console(record=True, width=100)
425432

@@ -532,6 +539,12 @@ def polls_table():
532539
Path(__file__).parent.parent / "doc/source/_static/img/polls_profile.svg"
533540
).write_text(svg, encoding="utf-8")
534541

542+
console.print(table)
543+
svg = console.export_text() # export as a string
544+
(
545+
Path(__file__).parent.parent / "doc/source/_static/img/polls_profile.txt"
546+
).write_text(svg, encoding="utf-8")
547+
535548
minimal_table()
536549
polls_table()
537550

0 commit comments

Comments
 (0)