Skip to content

Commit 728455e

Browse files
committed
Add measurement for deferring unittest
1 parent db41cc3 commit 728455e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

speedup_import.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ $./mtime.sh ~/.pyenv/versions/cmd2-3.6/bin/python -c ""
2121
average: real 0.028 user 0.020 sys 0.000
2222
```
2323

24+
2425
## Initial measurement
2526

26-
From commit c7753352b, which has `__init.py__` importing `cmd2.cmd2.Cmd`
27+
From commit fbbfe256, which has `__init.py__` importing `cmd2.cmd2.Cmd`
2728
and a bunch of other stuff, we get:
2829
```
2930
$ ./mtime.sh ~/.pyenv/versions/cmd2-3.6/bin/python -c "import cmd2"
@@ -34,3 +35,13 @@ average: real 0.140 user 0.100 sys 0.030
3435
From the baseline and this initial measurement, we infer it takes ~110 ms
3536
to import the `cmd2` module.
3637

38+
39+
## Defer unittest
40+
41+
In commit 8bc2c37a we deferring the import of `unittest` until we need it to
42+
test a transcript.
43+
```
44+
$./mtime.sh ~/.pyenv/versions/cmd2-3.6/bin/python -c "import cmd2"
45+
100 iterations
46+
average: real 0.131 user 0.091 sys 0.030
47+
```

0 commit comments

Comments
 (0)