Quote:
Originally Posted by Cubical
Thanks I'll defiantly try that. What would you say is a good load time to have everything loaded?
|
It really depends on the complexity of the data and so on. If it takes less than 0.1 seconds for one person at login it's pretty safe to say you have nothing to worry about.
One of the things I recommend though is the use of getfilemodtime(file), and using it with your cache to determine if you have to load the file or not.
Once upon a time Zodiac loaded a text file for every item the player had, every time they logged on. Using getfilemodtime(file) I was able to decrease login loading time (after the initial load) dramatically.
A test..
PHP Code:
function onCreated() {
temp.start = timevar2;
temp.count = 0;
for (temp.a: allplayers) {
temp.prefix = temp.a.account.substring(0, 2);
temp.lines.loadlines(format("accounts/%s/%s.txt", temp.prefix, temp.a.account));
temp.file++;
for (temp.i = 0; temp.i < temp.lines.size(); temp.i++) {
temp.count++;
}
}
echo("time" SPC timevar2-temp.start SPC "files parsed" SPC temp.file SPC "lines parsed" SPC temp.count);
}
Output:
PHP Code:
The script of NPC JerretNPC has been updated by fowlplay4
time 0.266197919 files parsed 43 lines parsed 23422
The script of NPC JerretNPC has been updated by fowlplay4
time 0.042979001 files parsed 42 lines parsed 24392
The script of NPC JerretNPC has been updated by fowlplay4
time 0.040443897 files parsed 42 lines parsed 24390
Seems fast enough to me.