jontingvold / pyrankvote

PyRankVote is a python library for different ranked-choice voting systems, like IRV, STV and PBV. Created in June 2019.
MIT License
53 stars 16 forks source link

Improve performance for medium to big elections #8

Open jontingvold opened 4 years ago

matthewdeanmartin commented 3 years ago

I can report that the code is noticeably slow with 100s of candidates. I just reduced the number of candidates & ran at an acceptable speed again.

jontingvold commented 3 years ago

Thanks. Good to know. Then I will definitely try to optimize it with Numpy/Pandas some time.

matthewdeanmartin commented 3 years ago

Counterpoint though, it is kind of nice to have a pure python library. What sort of workloads were you expecting? For my algo, my intuition was that having 2 voters with votes for 500 candidates & the rest with votes for 1 or 2 candidates was just a bad idea, (the 500th candidate on a ballot isn't going to win anyhow) & performance was better truncating the 2 voters' ballots with too many candidates on their ballots. Here is my code if you're curious: https://github.com/matthewdeanmartin/whats_that_code/blob/main/whats_that_code/election.py