Performance improvement for xml loads (+comments)

Al Snell alaric@alaric-snell.com
Thu, 7 Dec 2000 20:06:31 +0000 (GMT)


> > Also, if you do decide to try and whip something up, make sure you're
> > aware that we use kvp_frames now, in various places, so you will have
> > to be able to accomodate items with arbitrarily deep, recursive
> > key/value trees.
[...]
> > Of course you're welcome to, but why would you waste time on this
> > rather than trying to go forward with trying to integrate an embedded
> > MySQL or PostgreSQL?

Storing tree structures in SQL is hairy. Very hairy. Sufficiently so that
it may be worthwhile storing the kvp tree for an object in a binary format
in a BLOB field.

I've seen SQL databases with XML in the fields. It's not pretty. But you
still end up needing a neat way of storing trees, and the relational
model doesn't cut it.

Eg, even if we DO move to SQL, the complex bits of the disk format will
still be needed :-)

KVP in XDR from the top of my head:

enum kvp_type { /* Can't remember what types there are :-) */
	KVP_STRING = 0,
	KVP_INT = 1,
	KVP_FRAME = 2
};

union kvp_item switch(kvp_type type) {
case KVP_STRING:
	string string_body<>;
case KVP_INT:
	int int_body;
case KVP_FRAME:
	kvp_frame tree_body;
};

struct kvp_pair {
	string name<>;
	kvp_item value;
};

struct kvp_frame {
	kvp_pair contents<>;
};

...from the top of my head. Can't remember exactly what are allowed as
values in kvp_frames, but I'm sure you get the idea.

ABS

-- 
 http://www.alaric-snell.com/  http://RFC.net/  http://www.warhead.org.uk/
   Any sufficiently advanced technology can be emulated in software