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


Reply via email to