Message302768
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; |
|
Date |
User |
Action |
Args |
2017-09-22 20:24:22 | Safihre | set | recipients:
+ Safihre, paul.moore, tim.golden, zach.ware, steve.dower |
2017-09-22 20:24:22 | Safihre | set | messageid: <1506111862.7.0.559365962543.issue31555@psf.upfronthosting.co.za> |
2017-09-22 20:24:22 | Safihre | link | issue31555 messages |
2017-09-22 20:24:22 | Safihre | create | |
|