(02-15-2009 10:45 PM)twig Wrote: 1. reading from a file is quite slow
depending on the size of your text file, the reason why it is slow is the length of the file (how many lines) and how many paths it has to process per line.
Yes, I noticed load time is proportionate to file size. The file in question is quite large (932 lines).
In case anyone's wondering why:
This project is a completely new trivia bot to replace my previous one, and with it come many new features. Unfortunately, this also means the dialogs are far more elaborate now -- you can say
bloated; I won't be offended because I agree. I have trees for configuring everything from basic channel and question processing stuff to setting up team, tournament, ladder games, as well as bot personality (rudimentary AI). My purpose for this project was to design the most versatile and feature-rich trivia bot that I could for irc. To accomplish that, there must be a certain degree of excess.
The tree in question is a combination user stat/config box. It contains the various statistics (and there are a
lot) for each user/player as well as a plethora of configurable parameters for each user (such as handicaps, filters, remote bot access grant levels, etc.).
The reason I put this in a tree view is so that the bot operator can drill down to view only those desired items, as opposed to stuffing a separate listview with many many columns, requiring a lot of scrolling.
My current design populates a listview on the left side, from which the operator selects a user; that user's stats/settings are then loaded into the treeview at right. It turns out that
this is actually performed quickly. The lag occurs with the
initial loading of the treeview control itself. Once the trees have been loaded/populated once, I can switch back and forth between tabs with zero display delay.
One file holds all user data, with each user/player occupying a single line -- admittedly, bloated tokenization.
But, from my experimentation with different dialog designs for this project, this tree method definitely looks much cleaner and is easier to use.
Forgive the long-winded reply, but I wanted to explain why my trees are so massive.
I can try certain things to streamline processing, such as your suggestion to tokenize, but I can't do anything about the quantity of data w/o sacrificing versatility or level of control over the bot (and the game).