Wow.. a simple thing turns into a boost of information. 1. I am glad you guys have all thought of this. If I were to go through all the performance speedups at one time I would not be finished typing now :) 2. This was something I did to IMPROVE Debugging as well. I have long since had a hash crash bug and still have not been able to figure it out and all the variables around have been corrupted as well (its in fread_string, iHash is always 44). I changed it to make sure that I could view it in the debugger as wel.
The philosphy of performance improvement is introduced here. 1. Macros vs small Functions 2. Switch Statements vs If, Then, Else trees 3. single points of information (variable istead of multiple function calls) small or not, its still an improvement.. ----- Original Message ----- From: "Jason Gauthier" <[EMAIL PROTECTED]> To: "'Michael Barton'" <[EMAIL PROTECTED]>; "Chris "Winston" Litchfield" <[EMAIL PROTECTED]>; <[email protected]> Sent: Friday, July 18, 2003 10:18 AM Subject: RE: Simple Performance Speedup. > The difference is negligible. > > void main(void) > { > long i; > int size; > for(i=0;i<99999999; i++) > size = sizeof(char *); > > } > > real 0m2.684s > user 0m2.690s > sys 0m0.000s > > > void main(void) > { > long i; > int size; > int l = sizeof(char *); > for(i=0;i<99999999; i++) > size = l; > > } > > real 0m2.627s > user 0m2.620s > sys 0m0.010s > > > -----Original Message----- > > From: Michael Barton [mailto:[EMAIL PROTECTED] > > Sent: Friday, July 18, 2003 10:26 AM > > To: Chris "Winston" Litchfield; [email protected] > > Subject: Re: Simple Performance Speedup. > > > > > > sizeof isn't a function anyway. It's a unary operator > > evaluated at compile > > time. > > Replacing all of the calls to sizeof with a variable will in > > fact slow the > > program down, since it has to dig the value out of memory > > every time it's > > used, instead of having a constant. > > > > ----- Original Message ----- > > From: "Chris "Winston" Litchfield" <[EMAIL PROTECTED]> > > To: <[email protected]> > > Sent: Thursday, July 17, 2003 7:23 PM > > Subject: Simple Performance Speedup. > > > > > > > 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 *); > > > > > > Now you are ready.. in fread_string and other > > fread_functions that use > > > sizeof(char *) ALL OVER THE PLACE just replace it with charptrsize. > > > > > > Instant SPEEDup. Remember each unneeded function call adds > > a slight bit > > > slowdown. > > > > > > Chris "Winston" Litchfield > > > > > > -- > > ROM mailing list > > [email protected] > > http://www.rom.org/cgi-bin/mailman/listinfo/rom > > > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom > >

