hynek / argon2-cffi-bindings

Low-level Python CFFI Bindings for Argon2
MIT License
8 stars 9 forks source link

universal2 wheels #2

Closed hynek closed 2 years ago

hynek commented 2 years ago

Try if new compiling method works for some lucky reason.

hynek commented 2 years ago

OK, I've found the problem.

It's a cross-compilation to ARM on amd64 and it's trying to use the optimized version!

hynek commented 2 years ago

@henryiii OK, I think I've made it smart now. Care to have a quick look and tell me what you think?

henryiii commented 2 years ago

Looks good. Is there an easy way for me to test on an M1? (Specifically, is there a good way to run the test suite on an existing wheel?)

hynek commented 2 years ago

I know of none. :( Still M1-less myself.

This code is on PyPI so a good way to test would be to run the test suite of current main of argon2-cffi

henryiii commented 2 years ago

Guessing this is what I'm supposed to see?

% time tox -e py310
.package create: /Users/henryfs/git/software/argon2-cffi/.tox/.package
.package installdeps: flit_core >=3.4,<4
py39 create: /Users/henryfs/git/software/argon2-cffi/.tox/py39
py39 inst: /Users/henryfs/git/software/argon2-cffi/.tox/.tmp/package/1/argon2-cffi-21.2.0.dev0.tar.gz
py39 installed: argon2-cffi @ file:///Users/henryfs/git/software/argon2-cffi/.tox/.tmp/package/1/argon2-cffi-21.2.0.dev0.tar.gz,argon2-cffi-bindings==21.2.0,attrs==21.2.0,cffi==1.15.0,coverage==6.2,hypothesis==6.29.0,iniconfig==1.1.1,packaging==21.3,pluggy==1.0.0,py==1.11.0,pycparser==2.21,pyparsing==3.0.6,pytest==6.2.5,sortedcontainers==2.4.0,toml==0.10.2,tomli==1.2.2
py39 run-test-pre: PYTHONHASHSEED='996790143'
py39 run-test: commands[0] | python -m pytest
============================================= test session starts =============================================
platform darwin -- Python 3.9.9, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
cachedir: .tox/py39/.pytest_cache
rootdir: /Users/henryfs/git/software/argon2-cffi, configfile: pyproject.toml, testpaths: tests
plugins: hypothesis-6.29.0
collected 67 items                                                                                            

tests/test_legacy.py ..................
tests/test_low_level.py ........................
tests/test_password_hasher.py .............
tests/test_utils.py ............

============================================= 67 passed in 2.08s ==============================================
py39 run-test: commands[1] | python -m argon2 -n 1 -t 1 -m 8 -p 1
Running Argon2id 1 times with:
hash_len: 16 bytes
memory_cost: 8 KiB
parallelism: 1 threads
time_cost: 1 iterations

Measuring...

0.0ms per password verification
___________________________________________________ summary ___________________________________________________
  py39: commands succeeded
  congratulations :)
tox -e py310  7.94s user 1.16s system 110% cpu 8.235 total

Takes 15 seconds on my Intel Mac, and 8 seconds on my M1.

hynek commented 2 years ago

I could have compiled it in the background…i guess the wheel test would be an pip install argon2-cffi-bindings and look what it does. 🤔

henryiii commented 2 years ago

Does it take less than 8 seconds to compile?

hynek commented 2 years ago

Well I’m hearing the M1 are really fast. 😅 But unlikely, yeah.