Skip to content

Commit 58ff9e2

Browse files
authored
Merge pull request #90 from kurtmckee/perf-test-fixes-linux
Fix performance testing issues, and capture more data, on Linux
2 parents 603264a + d4aba47 commit 58ff9e2

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

assets/test-performance.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ rm -rf "build/perftest" || true
99
rm perf.* || true
1010
python assets/generate-perftest-directory.py
1111

12+
# Note the size of the source code tree.
13+
echo "Source tree" > perf.files.log
14+
du --max-depth=0 --bytes build/perftest >> perf.files.log
15+
16+
1217
export PYTHONPROFILEIMPORTTIME=1
1318
export PYTHONDONTWRITEBYTECODE=1
1419

@@ -53,8 +58,16 @@ command time --portability --output "${FILE_PREFIX}.time.log" \
5358
# Compile the source to bytecode
5459
# ------------------------------
5560

61+
# Compile into `__pycache__/` subdirectories for the filesystem.
5662
PYTHONPROFILEIMPORTTIME="" python -m compileall -q "build/perftest"
5763

64+
# Note the size of the tree, including bytecode.
65+
echo "Source tree with bytecode" >> perf.files.log
66+
du --max-depth=0 --bytes build/perftest >> perf.files.log
67+
68+
# Compile in-place for zipimport.
69+
PYTHONPROFILEIMPORTTIME="" python -m compileall -b -q "build/perftest"
70+
5871

5972
# Filesystem -- bytecode
6073
# ----------------------
@@ -75,7 +88,7 @@ export FILE_PREFIX="perf.zip.bytecode"
7588
echo "${FILE_PREFIX}"
7689
export PYTHONPATH="${FILE_PREFIX}.zip"
7790
cd "build/perftest"
78-
zip -qr9 "../../${PYTHONPATH}" .
91+
zip -qr9 "../../${PYTHONPATH}" . --exclude '*/__pycache__/*'
7992
cd "../.."
8093
command time --portability --output "${FILE_PREFIX}.time.log" \
8194
python -c 'import a; print(a)' 2> "${FILE_PREFIX}.import.log"
@@ -97,4 +110,4 @@ command time --portability --output "${FILE_PREFIX}.time.log" \
97110
# Capture the file sizes
98111
# ----------------------
99112

100-
ls -l perf.* > perf.files.log
113+
ls -l perf.*.zip perf.*.sqlite3 >> perf.files.log
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Development
2+
-----------
3+
4+
* Fix performance testing issues, and capture more data, on Linux.
5+
6+
Zip-based bytecode import times were skewed during testing
7+
because ``zipimport`` doesn't use PEP 3147 ``__pycache__/`` subdirectories.
8+
This is now accounted for by the performance testing script's setup steps,
9+
and zip-based import times are significantly more accurate.
10+
11+
Also, the total size of the source code and byte code trees is captured.

0 commit comments

Comments
 (0)