Proof of Work refactoring and multi-core support. #176
No reviewers
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-02#176
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I moved the basic proof of work loop into it's own file, where I could mess with it easier (instead of having the same code appear a half dozen times in bitmessagemain.py).
I then modified it to attempt to detect your # of cores and launch one child process per core. It checks once per second to see if a solution has been found, and kills any remaining child processes once this has happened. I have no idea how to properly do multiprocessing in python, but this does seem to work.
Aside from faster hashing, the UI seems to be more responsive when PoW isn't in the same process.
Only tested on (X)ubuntu 12.04, YMMV.
This now seems to be in a hackish but functional state on linux.
It could use some testing on windows, if anyone's interested. In particular, try to shut down bitmessage while proof of work is running. See if it hangs until the children exit naturally, or anything like that.
Hi Arceliar,
On Friday I started working on testing and merging this. At the time, the "Consistent use of i as an iterator" commit was the latest one so I worked on a method of killing child processes on exit, and testing on various operating systems. I merged the changes into the master branch just a little while ago. I only saw the rest of your commits just now so I'm sorry they didn't get included. I will manually add the "Workers get idle priority" code and merge that into master.
Atheros