• Jason Madden's avatar
    Compile local.py with Cython when available. · 5ba9ab73
    Jason Madden authored
    This makes things *much* faster. We had to make some small code
    changes to acheive this (things like directly accessing variables
    instead of redirecting through object.__getattribute__), but this
    didn't impart PyPy at all (in fact it may actually be faster). New
    timings compared to previous commit:
    
    | Operation             | PyPy 2        | Python 2.7    | Python 3.6    |
    |---------------------- |-------:       |-----------:   |-----------:   |
    | getattr local         |   76ns        |      233ns    |      206ns    |
    | setattr local         |   79ns        |      232ns    |      202ns    |
    | getattr subclass      |   77ns        |      238ns    |      203ns    |
    | setattr subclass      |   75ns        |      238ns    |      204ns    |
    | getattr native local  |    2ns        |      139ns    |       73ns    |
    | setattr native local  |    2ns        |      168ns    |       98ns    |
    | getattr slowdown        	|  38x 	|     1.7x 	|     2.8x 	|
    | setattr slowdown        	|  39x 	|     1.7x 	|     2.1x 	|
    5ba9ab73
setup.py 7 KB