on master help sign in
Reduce the number of nodes to 500
commit866ac037d8c34ee9dba9656e5512add40db4b7ed authorNeil Mitchell <ndmitchell@gmail.com> dateWed 30 Nov 2016, 19:08 (10 years ago) parent0486a23
1 file changed+4−2
cbits/hexml.c+4−2
cbits/hexml.c+4−2
@@ -486,11 +486,13 @@ str parse_content(document* d)
486486 return res;
487487}
488488
489+// Based on looking at ~50Kb XML documents, they seem to have ~700 attributes
490+// and ~300 nodes, so size appropriately to cope with that.
489491typedef struct
490492{
491493 document document;
492494 attr attrs[1000];
493− node nodes[1000];
495+ node nodes[500];
494496} buffer;
495497
496498document* document_parse(char* s, int slen)
@@ -509,7 +511,7 @@ document* document_parse(char* s, int slen)
509511 d->attrs.used = 0;
510512 d->attrs.attrs = buf->attrs;
511513 d->attrs.alloc = NULL;
512− d->nodes.size = 1000;
514+ d->nodes.size = 500;
513515 d->nodes.used_back = 0;
514516 d->nodes.used_front = 1;
515517 d->nodes.nodes = buf->nodes;