Re: [Tracker] some patches




On Thu, 2008-02-14 at 17:31 +0100, Laurent Aguerreche wrote:
Le mercredi 13 fÃvrier 2008 Ã 18:09 +0100, Carlos Garnacho a Ãcrit :
Hi!,

This was just a heads up to these three bugs:

#513692 : This one just packs booleans in guints, so it should improve
size in most used structs.

Is it so interesting to save some bytes this way?

In tracker-utils, this patch will replace 25 gbooleans with 25 "uint:1".
If I assume that gboolean is a typedef of gint and that gint uses 4
bytes, this patch will save (25*4)-25 = 75 bytes (perhaps a little bit
more but IMHO not much more because we use pointers everywhere and we
take care of memory allocations).
So we would prefer to write some weird things (using of unsigned int
instead of booleans) to save ~75 bytes?

Another question: why glib does use a typedef of gint instead of a
typedef of "guint:1" for its booleans?


the 25 booleans will be packed into a single gint of 32 bytes 

a single boolean may use 32 bits on a 32 bit machine although that will
depend on cpu architecture of course (just guessing the risc based arm
chip on the nokia works like that?)


#513691 : a similar improvement to #511788 (already committed) in a
different function.

+     res = g_ptr_array_sized_new (100);

What is "100"?!

array has preallocated for 100 entries (or rows in the dataset I believe)

at least that is my understanding, carlos can correct me if im wrong

jamie





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]