jtoomim / p2pool

Peer-to-peer Bitcoin mining pool
https://github.com/jtoomim/p2pool/
GNU General Public License v3.0
37 stars 45 forks source link

34-memfree branch - username.worker syntax parses diff as worker #34

Closed chargr closed 5 years ago

chargr commented 5 years ago

The recent username in this branch I dont think work as intended all the time. username+16.999 the 999 gets treated as the worker, and the pseudo share diff gets set to 16.

A second split of the username should maybe be done separately?

Can the regex here be pre-compiled, or is class/object created on each request? This is not the most accurate test, but the difference seems pretty consistent.

>>> reg = re.compile('[/+]')
>>> now = time.time(); re.split("[/+]", "worker+16.000"); print("{:.8f}".format(time.time() - now))
['worker', '16.000']
0.00003386
>>> now = time.time(); reg.split("worker+16.000"); print("{:.8f}".format(time.time() - now))
['worker', '16.000']
0.00002599
jtoomim commented 5 years ago

Thanks for pointing this out. I'll fix it.

jtoomim commented 5 years ago

https://github.com/jtoomim/p2pool/commit/72c72f5b50037c437c0dd5e49512a11b51d2151e