Skip to content

Commit c29c4c3

Browse files
authored
Merge pull request #91 from kurtmckee/perf-test-fixes-windows
Fix performance testing issues, and capture more data, on Windows
2 parents 58ff9e2 + 576449c commit c29c4c3

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

assets/test-performance.ps1

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55
$env:PYTHONPROFILEIMPORTTIME=$null
66
$env:PYTHONDONTWRITEBYTECODE=1
77

8-
Remove-Item -Recurse "build\perftest"
9-
Remove-Item perf.*
8+
Remove-Item -Recurse "build\perftest" | Out-Null
9+
Remove-Item perf.* | Out-Null
1010
python assets/generate-perftest-directory.py
1111

12+
# Note the size of the source code tree.
13+
Write-Output "Source tree" > perf.files.log
14+
Get-ChildItem -Recurse "build\perftest" | Measure-Object -Sum Length >> perf.files.log
15+
16+
1217
$env:PYTHONPROFILEIMPORTTIME=1
18+
$env:PYTHONDONTWRITEBYTECODE=1
1319

1420

1521
# Filesystem -- source only
@@ -57,7 +63,17 @@ Measure-Command {
5763
# ------------------------------
5864

5965
$env:PYTHONPROFILEIMPORTTIME=$null
66+
67+
# Compile into `__pycache__/` subdirectories for the filesystem.
6068
python -m compileall -q "build\perftest"
69+
70+
# Note the size of the tree, including bytecode.
71+
Write-Output "Source tree with bytecode" >> perf.files.log
72+
Get-ChildItem -Recurse "build\perftest" | Measure-Object -Sum Length >> perf.files.log
73+
74+
# Compile in-place for zipimport.
75+
python -m compileall -b -q "build\perftest"
76+
6177
$env:PYTHONPROFILEIMPORTTIME=1
6278

6379

@@ -76,6 +92,10 @@ Measure-Command {
7692
# Zip -- bytecode
7793
# ---------------
7894

95+
# Delete the `__pycache__\` directories.
96+
$cache_paths = Get-ChildItem -Recurse "build\perftest" | Where-Object { $_.Name -eq "__pycache__" }
97+
Remove-Item -Recurse $cache_paths | Out-Null
98+
7999
Write-Host
80100
$env:FILE_PREFIX="perf.zip.bytecode"
81101
Write-Host "${env:FILE_PREFIX}"
@@ -105,4 +125,4 @@ Measure-Command {
105125
# Capture the file sizes
106126
# ----------------------
107127

108-
Get-ChildItem perf.* > perf.files.log
128+
Get-ChildItem perf.*.zip,perf.*.sqlite3 >> perf.files.log
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Development
22
-----------
33

4-
* Fix performance testing issues, and capture more data, on Linux.
4+
* Fix performance testing issues.
55

66
Zip-based bytecode import times were skewed during testing
77
because ``zipimport`` doesn't use PEP 3147 ``__pycache__/`` subdirectories.
88
This is now accounted for by the performance testing script's setup steps,
9-
and zip-based import times are significantly more accurate.
9+
and zip-based import times are now accurate for comparison.
1010

1111
Also, the total size of the source code and byte code trees is captured.

0 commit comments

Comments
 (0)