[issue25106] Hash computation speedup for {buffer, string, unicode}object

Alecsandru Patrascu report at bugs.python.org
Mon Sep 14 09:29:28 CEST 2015


New submission from Alecsandru Patrascu:

Hi All,

This is Alecsandru from Server Scripting Languages Optimization team at Intel Corporation.

I would like to submit a patch that improves the performance of the hash computation code on stringobject, bufferobject and unicodeobject. As can be seen from the attached sample performance results from the Grand Unified Python Benchmark, speedups up to 40% were observed. Furthermore, we see a 5-7% performance on OpenStack/Swift, where most of the code is in Python 2.7.

Attached is the patch that modifies Object/stringobject.c, Object/bufferobject.c and Object/unicodeobject.c files. We built and tested this patch for Python 2.7 on our Linux machines (CentOS 7/Ubuntu Server 14.04, Intel Xeon Haswell/Broadwell with 18/8 cores).

Steps to apply the patch:
1.  hg clone https://hg.python.org/cpython cpython 
2.  cd cpython 
3.  hg update 2.7
4.  Copy hash8.patch to the current directory 
5.  hg import --no-commit hash8.patch
6.  ./configure 
7.  make



In the following, please find our sample performance results measured on a XEON Haswell machine.  

Hardware (HW):      Intel XEON (Haswell) 18 Cores

BIOS settings:      Intel Turbo Boost Technology: false
                    Hyper-Threading: false

Operating System:   Ubuntu 14.04.3 LTS trusty

OS configuration:   CPU freq set at fixed: 2.0GHz by
                        echo 2000000 > /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
                        echo 2000000 > /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
                    Address Space Layout Randomization (ASLR) disabled (to reduce run to run variation) by
                        echo 0 > /proc/sys/kernel/randomize_va_space
                
GCC version:        gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)

Benchmark:          Grand Unified Python Benchmark (GUPB)
                    GUPB Source: https://hg.python.org/benchmarks/                    

Python2.7 results:
    Python source: hg clone https://hg.python.org/cpython cpython
    Python Source: hg update 2.7

        Benchmarks          Speedup(%)
        unpack_sequence     40.32733766
        chaos               24.84002537
        chameleon           23.01392651
        silent_logging      22.27202911
        django              20.83842317
        etree_process       20.46968294
        nqueens             20.34234985
        pathlib             19.63445919
        pidigits            19.34722148
        etree_generate      19.25836634
        pybench             19.06895825
        django_v2           18.06073108
        etree_iterparse     17.3797149
        fannkuch            17.08120879
        pickle_list         16.60363602
        raytrace            16.0316265
        slowpickle          15.86611184
        pickle_dict         15.30447114
        call_simple         14.42909032
        richards            14.2949594
        simple_logging      13.6522626
        etree_parse         13.38113097
        json_dump_v2        12.26588885
        float               11.88164311
        mako                11.20606516
        spectral_norm       11.04356684
        hg_startup          10.57686164
        mako_v2             10.37912648
        slowunpickle        10.24030714
        go                  10.03567319
        meteor_contest      9.956231435
        normal_startup      9.607401586
        formatted_logging   9.601244811
        html5lib            9.082603748
        2to3                8.741557816
        html5lib_warmup     8.268150981
        nbody               7.507012306
        regex_compile       7.153922724
        bzr_startup         7.140244739
        telco               6.869411927
        slowspitfire        5.746323922
        tornado_http        5.24360121
        rietveld            3.865704876
        regex_v8            3.777622219
        hexiom2             3.586305282
        json_dump           3.477551682
        spambayes           3.183991854
        fastunpickle        2.971645347
        fastpickle          0.673086656
        regex_effbot        0.127946837
        json_load           0.023727176

Thank you,
Alecsandru

----------
components: Interpreter Core
files: hash8-v01.patch
keywords: patch
messages: 250639
nosy: alecsandru.patrascu
priority: normal
severity: normal
status: open
title: Hash computation speedup for {buffer,string,unicode}object
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file40456/hash8-v01.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25106>
_______________________________________


More information about the Python-bugs-list mailing list