--- "Chris \"Winston\" Litchfield" <[EMAIL PROTECTED]> wrote: > Tip of the day. > > fread_string and other fread_* functions are used a lot. It would make > sense that they be as fast as possible....... it is why they are using HASH > tables for string combining... > > So.. a tip of the day. > > in db.c at the top make a variable called "charptrsize" an int. > in boot_db do: > charptrsize = sizeof(char *);
[snip] > Instant SPEEDup. Remember each unneeded function call adds a slight bit > slowdown. Firstly, if you are actually going to do this, you should use a const size_t not just an int, as it's not unsigned, and it's not going to change through program execution. Secondly, you're focusing on the wrong area. If you actually run ROM through a profiler, you'll see that the places ROM spends most of it's time is not in fread_string. In fact, these are only typically called at boot up, and when a new player connects. If you want to look for things to optimize, start with the update handlers. For example, creating a new linked list for the character data to quickly determine which creatures are currently in a fight will save your process a lot of time when it does the violence update every second or so. That's assuming you didn't really want to clean things up, in which case an event queue will really help with a lot of the empty loops which occur throught the ROM code. Just some suggestions, ~Kender ===== -----BEGIN GEEK CODE BLOCK----- Version 3.1 GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$ P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@ b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++ ------END GEEK CODE BLOCK------ __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com

