Skip to content

Commit 009fb07

Browse files
committed
Benchmark the same interpreter from release to release.
1 parent a07d390 commit 009fb07

3 files changed

Lines changed: 50 additions & 6 deletions

File tree

‎RELEASING.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,16 @@ docker run -it --entrypoint /bin/bash YOUR-IMAGE-NAME
7272
There is a benchmark suite which compares the performance of interpreters
7373
against each other.
7474

75+
**Benchmark different versions of interpreter in the same release
76+
77+
``` shell
78+
DOCKER_NAMESPACE=DOCKER_NAMESPACE_EXAMPLE TAG=TAG_EXAMPLE ./build.sh --nobuild --benchmark
79+
```
80+
81+
**Benchmark same versions of interpreter from release to release
82+
7583
``` shell
76-
./build.sh --nobuild --benchmark
84+
DOCKER_NAMESPACE=DOCKER_NAMESPACE_EXAMPLE TAG1=TAG1_EXAMPLE TAG2=TAG2_EXAMPLE ./benchmark_between_releases.sh
7785
```
7886

7987
Since these benchmarks are run on cloud instances, the timings may vary from run

‎tests/benchmark/Dockerfile.in‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ RUN wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
1111
RUN tar xzf Python-3.4.2.tgz
1212
RUN cp -R Python-3.4.2/Lib/ensurepip /usr/lib/python3.4
1313

14+
RUN mkdir /result
15+
1416
# Run the benchmark and compare the performance, add the --debug-single-value flag to let the benchmark run in fastest mode
15-
RUN pyperformance run --debug-single-value --python=python2.7 -o py2.7.json
16-
RUN pyperformance run --debug-single-value --python=python3.4 -o py3.4.json
17-
RUN pyperformance run --debug-single-value --python=python3.5 -o py3.5.json
18-
RUN pyperformance compare py2.7.json py3.4.json --output_style table
19-
RUN pyperformance compare py3.4.json py3.5.json --output_style table
17+
RUN pyperformance run --debug-single-value --python=python2.7 -o /result/py2.7.json
18+
RUN pyperformance run --debug-single-value --python=python3.4 -o /result/py3.4.json
19+
RUN pyperformance run --debug-single-value --python=python3.5 -o /result/py3.5.json
20+
RUN pyperformance compare /result/py2.7.json /result/py3.4.json --output_style table
21+
RUN pyperformance compare /result/py3.4.json /result/py3.5.json --output_style table
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Build the benchmark image for release 1 from Dockerfile
4+
echo "Building image for release 1"
5+
export FULL_BASE_IMAGE="${DOCKER_NAMESPACE}/python:${TAG1}"
6+
envsubst <"Dockerfile".in >"Dockerfile" '$FULL_BASE_IMAGE'
7+
docker build --no-cache -t benchmark_1 .
8+
rm Dockerfile
9+
10+
# Build the benchmark image for release 2 from Dockerfile
11+
echo "Building image for release 2"
12+
export FULL_BASE_IMAGE="${DOCKER_NAMESPACE}/python:${TAG2}"
13+
envsubst <"Dockerfile".in >"Dockerfile" '$FULL_BASE_IMAGE'
14+
docker build --no-cache -t benchmark_2 .
15+
rm Dockerfile
16+
17+
echo "Successfully built images"
18+
19+
# Create folders to hold the files
20+
mkdir release1
21+
mkdir release2
22+
23+
# Start running the containers and copy the benchmark result for python versions from container to host
24+
docker run -it --name benchmark_1 -h CONTAINER1 -v "${PWD}"/release1:/export benchmark_1 /bin/bash -c "cp /result/py*.json /export/"
25+
docker run -it --name benchmark_2 -h CONTAINER2 -v "${PWD}"/release2:/export benchmark_2 /bin/bash -c "cp /result/py*.json /export/"
26+
27+
echo "Start benchmarking the python interpreter performance between the two releases"
28+
29+
# Compare the performance between the interpreter in different release
30+
pyperformance compare release1/py2.7.json release2/py2.7.json --output_style table > py2.7_res
31+
pyperformance compare release1/py3.4.json release2/py3.4.json --output_style table > py3.4_res
32+
pyperformance compare release1/py3.5.json release2/py3.5.json --output_style table > py3.5_res
33+
34+
echo "Completed"

0 commit comments

Comments
 (0)