New submission from Alecsandru Patrascu:
Hi all,
This is Alecsandru from the Dynamic Scripting Languages Optimization Team at
Intel Corporation. I would like to submit a patch that enables garbage
collection of unused input sections from the CPython2 and CPython3 binaries, by
using the "--gc-sections" linker flag, which decides which input sections are
used by examining symbols and relocations. In order for this to work, GCC must
place each function or data item into its own section in the output file, thus
dedicated flags are used. With this technique, an average of 1% is gained in
both interpreters, with a few small regressions.
Steps:
======
1. Get the CPython source codes
hg clone https://hg.python.org/cpython cpython
cd cpython
hg update 2.7 (for CPython2)
2. Build the binary
a) Default:
./configure
make
b) Unused input sections patch
Copy the attached patch files
hg import --no-commit cpython2-deadcode-v01.patch.patch (for CPython3)
hg import --no-commit cpython2-deadcode-v01.patch (for CPython2)
./configure
make
Hardware and OS Configuration
=============================
Hardware: Intel XEON (Haswell-EP) 18 Cores
BIOS settings: Intel Turbo Boost Technology: false
Hyper-Threading: false
OS: Ubuntu 14.04.3 LTS Server
OS configuration: Address Space Layout Randomization (ASLR) disabled to
reduce run
to run variation by echo 0 >
/proc/sys/kernel/randomize_va_space
CPU frequency set fixed at 2.6GHz
GCC version: GCC version 4.9.2
Benchmark: Grand Unified Python Benchmark from
https://hg.python.org/benchmarks/
Measurements and Results
========================
CPython2 and CPython3 sample results, measured using GUPB on a Haswell
platform, can be viewed in Table 1 and 2. On the first column (Benchmark) you
can see the benchmark name and on the second (%S) the speedup compared with the
default version; a higher value is better.
Table 1. CPython3 results:
Benchmark %S
----------------------
telco 11
etree_parse 7
call_simple 6
etree_iterparse 5
regex_v8 4
meteor_contest 3
etree_process 3
call_method_unknown 3
json_dump_v2 3
formatted_logging 2
hexiom2 2
chaos 2
richards 2
django_v3 2
nbody 2
etree_generate 2
pickle_list 1
go 1
nqueens 1
call_method 1
mako_v2 1
raytrace 1
chameleon_v2 1
silent_logging 0
fastunpickle 0
2to3 0
float 0
regex_effbot 0
pidigits 0
json_load 0
simple_logging 0
normal_startup 0
startup_nosite 0
fastpickle 0
tornado_http 0
regex_compile 0
fannkuch 0
spectral_norm 0
pickle_dict 0
unpickle_list 0
call_method_slots 0
pathlib -2
unpack_sequence -2
Table 2. CPython2 results:
Benchmark %S
----------------------
simple_logging 4
formatted_logging 3
slowpickle 2
silent_logging 2
pickle_dict 1
chameleon_v2 1
hg_startup 1
pickle_list 1
call_method_unknown 1
pidigits 1
regex_effbot 1
regex_v8 1
html5lib 0
normal_startup 0
regex_compile 0
etree_parse 0
spambayes 0
html5lib_warmup 0
unpack_sequence 0
richards 0
rietveld 0
startup_nosite 0
raytrace 0
etree_iterparse 0
json_dump_v2 0
fastpickle 0
slowspitfire 0
slowunpickle 0
call_simple 0
float 0
2to3 0
bzr_startup 0
json_load 0
hexiom2 0
chaos 0
unpickle_list 0
call_method_slots 0
tornado_http 0
fastunpickle 0
etree_process 0
spectral_norm 0
meteor_contest 0
pybench 0
go 0
etree_generate 0
mako_v2 0
django_v3 0
fannkuch 0
nbody 0
nqueens 0
telco -1
call_method -2
pathlib -3
Thank you,
Alecsandru
----------
components: Build
files: cpython2-deadcode-v01.patch
keywords: patch
messages: 259572
nosy: alecsandru.patrascu
priority: normal
severity: normal
status: open
title: Garbage collection of unused input sections from CPython binaries
type: performance
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file41805/cpython2-deadcode-v01.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26285>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com