Quote:
Originally Posted by Eratosthenes
You see this delay when you click on the entry in the task bar? Then it takes a few sec for the HUD stat windows to actually appear?
Yes, it does – sometimes. Allow me to elaborate.
First of all, many thanks for the new hand importer; it speeds things up enormously.
But there are still some problems with the HUD’s responsiveness, for quite interesting reasons.
One thing I didn’t mention is a hack I introduced earlier, and didn’t bother to get rid of, in an attempt to speed things up. I decided to see what would happen if I delayed the call to the database to collect the HUD cache information.
In HUD_main I changed the call to update the HUD:
Code:
db_connection = Database.Database(config, db_name, 'temp')
.
.
.
if hud_dict.has_key(table_name):
hud_dict[table_name].update(new_hand_id, db_connection, config)
to read:
Code:
if hud_dict.has_key(table_name):
hud_dict[table_name].update(new_hand_id, config, db_name, "temp")
making the appropriate changes to the parameters of the update method in Hud.py so that it could open its own connection to the database instead of having to use the one passed to it as a parameter, as was previously the case. I then changed the behaviour of the HUD so that it would only open this connection and demand the HUD information at such time as the user chose to make the HUD visible (since I keep most of the HUD windows invisible most of the time). This is very much a non-ideal solution.
I thought this modification of mine had probably done nothing to improve efficiency, and so changed it back after installing your new importer.
Unfortunately, what this now means is that opening a HUD becomes a sort of lottery: between hand-parsing cycles extremely responsive; but actually during a cycle unacceptably slow. By “unacceptably” I mean that it sometimes takes a HUD about
ten seconds to show up at all. I know my machine is a bit slow, but even so!
My guess, however, is that there is an extremely simple solution. If I understand the code correctly, in Linux the HUD process is single-threaded. So perhaps all that is needed is a little multi-threading magic.