[KimDaBa] Profiling Kimdaba startup

Jody Harris havoc at harrisdev.com
Wed Jan 5 08:40:39 CET 2005


Robert L Krawitz wrote:
<snip>
> To demonstrate this, I did the following test (it's necessary to use
> two cat processes in a pipeline, because the way cat works, using
> memory mapped I/O, if the destination is /dev/null it does almost no
> work).  Note that the second time (when the file was in memory) the
> amount of time spent was completely negligible.
<snip>

Okay, thanks for clearing that up for me.  I knew it wasn't that simple. 
  I just wasn't adding things up.  May I claim the, "It was late," excuse?

There are still some advantages to storing compressed data...

which brings me to a question I've never asked (which may or may not 
relate to speed):

In index.xml, I have a list of "Keywords" in values (the same for 
Locations, Persons, and any top-level categories I create).  When I get 
down to the image data, every "value" is repeated in full text.

I would have approached it differently.  I would have created an index, 
and assigned values to those indexes.  Then, rather than repeating the 
verbose value in the image record, I would just have given a list of 
indexes.

Yours:
   <option viewtype="0" viewsize="0" icon="password" name="Keywords" 
show="1" >
    <value value="Christmas" />
    <value value="music" />
    <value value="Church" />
    <value value="Barn" />
    <value value="rainbow" />
    ...

Mine:
   <option viewtype="0" viewsize="0" icon="password" name="Keywords" 
show="1" >
    <value index=1 value="Christmas" />
    <value index=2 value="music" />
    <value index=3 value="Church" />
    <value index=4 value="Barn" />
    <value index=5 value="rainbow" />
    ...

In memory, I would have created a hash for each category, then used that 
hash to populate any output functions.  (Warning: I think in Perl.)

Building the hash reference by hand would have looked like this:

$keywordref = {
	1 => "Christmas",
	2 => "music",
	3 => "Church",
	4 => "rainbow",
	...
	}	

Output would look something like:
	print "Persons: "
	foreach (@image_persons)
	{
		print "$keywordref->{$_}, ";
	}

where @image_persons is a per-image array of keyword indexes.  (Add all 
the wrap for sorting, presentation, etc.)

It seems to me, and again, I could be completely off track, that parsing:
	<option name="Keywords" >
		<value value="1, 2, 3, 4" >
	</option>

would be quicker.

I'm sure there's a reason you did it the way you did it.  Could you 
illuminate?

Thanks,
jody
-- 
http://www.RealizationSystems.com/ -- start communicating
http://www.GalacticSlacker.com/ -- read it and weep
http://www.NMPerspective.com/ -- a Southwest Perspective



More information about the KimDaBa mailing list