I noticed that on tilde.town users with a high botany score used up a
lot of CPU cycles. I skimmed through the code and didn't immediately see
any tight loops, but after profiling against a user's borrowed .botany
directory I saw the culprit: the score increase thread.
This thread was designed to increase the user's score by 1 every time
the thread did an iteration of its infinite loop. It would sleep for an
interval scaled *down* based on how high a user's generation bonus was.
This meant that the sleep interval trended towards zero, creating a
tight loop for high scoring users.
This commit changes the code to use a constant sleep inteveral but scale
the score increment *up* based on generation.
I also removed the death check thread entirely since we were already
checking for death in the score thread. I also short circuited the death
check.
This had the effect of reducing CPU load for a high scoring user by a
factor of about 50.
python2 division of integers always results in an integer, so `(2/3)` would result in `0`.
This caused all plants to get "godly" as rarity.
This change makes sure a float division is being used
python botany-view.py will give you a snapshot look of your garden plot,
showing what is in there. Instead of an interactive curses interface, it
just shows you your plant as it currently is. It's like just taking a
peek through the window, or a picture of your plant to show to your
friends.
The help menu points out to the readme for more info, but, in cases
where people are using this because it is installed on their server, but
they weren't the ones getting it from the web, they probably don't know
where to find that README. It might not happen to many people, but it
happened to me :-)
This patch just adds another line, with the URL for the README.