This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Safihre
Recipients Safihre, paul.moore, steve.dower, tim.golden, zach.ware
Date 2017-09-22.20:24:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506111862.7.0.559365962543.issue31555@psf.upfronthosting.co.za>
In-reply-to
Content
I have a Python 2.7 C-extension that was made for performance, however, I noticed something strange on Windows:
When I run locally python setup.py install and it installs it the "egg" way, the performance of calling the function in the module 500x in a loop is:

     yEnc C New  took   579 ms
     yEnc C New  took   580 ms
     yEnc C New  took   580 ms

But when I install it as a wheel locally or via pip without a single change to the C-code, this is the result:

     yEnc C New  took   702 ms
     yEnc C New  took   694 ms
     yEnc C New  took   691 ms

That's a 10-15% difference. I also checked macOS and Ubuntu, here it does not seem to be the case.
By investigating (https://github.com/pypa/setuptools/issues/1154) I found that the difference is only that the "egg" way the module gets loaded via imp.load_dynamic 

I cannot test under Python 3, since the module is (not yet) converted to Python 3-style.


To reproduce run and look at the yEnc C New score between the 2 ways (on Windows only of course):

git clone https://github.com/sabnzbd/sabyenc.git
cd sabyenc
python setup.py install
python .\tests\speed_compare.py; python .\tests\speed_compare.py;python .\tests\speed_compare.py;
pip uninstall sabyenc -y

pip install sabyenc
# Or this:
# python setup.py install bdist_wheel
# pip install .\dist\sabyenc-3.3.1-cp27-cp27m-win_amd64.whl
python .\tests\speed_compare.py; python .\tests\speed_compare.py;python .\tests\speed_compare.py;
History
Date User Action Args
2017-09-22 20:24:22Safihresetrecipients: + Safihre, paul.moore, tim.golden, zach.ware, steve.dower
2017-09-22 20:24:22Safihresetmessageid: <1506111862.7.0.559365962543.issue31555@psf.upfronthosting.co.za>
2017-09-22 20:24:22Safihrelinkissue31555 messages
2017-09-22 20:24:22Safihrecreate