Okay time to improve performances, gprof session:
before real 0m2.483s (2.3.2 release yesterday)
current real 0m1.763s
when parsing (with tree build/freeing) db10000.xml from XSLTMark:
- xmlmemory.h HTMLparser.c HTMLtree.c entities.c parser.c
xpath.c xpointer.c tree.c uri.c valid.c xinclude.c xmlIO.c:
avoiding memcpy in production builds MEM_CLEANUP macro use
- parser.[ch] parserInternals.c: optimizations of the tightest
internal loops inside the parser. Better checking of I/O
flushing/loading conditions
- xmllint.c : added --timing
Daniel
diff --git a/tree.c b/tree.c
index ae9c8c2..42acf7c 100644
--- a/tree.c
+++ b/tree.c
@@ -205,7 +205,7 @@
}
if (cur->href != NULL) xmlFree((char *) cur->href);
if (cur->prefix != NULL) xmlFree((char *) cur->prefix);
- memset(cur, -1, sizeof(xmlNs));
+ MEM_CLEANUP(cur, sizeof(xmlNs));
xmlFree(cur);
}
@@ -423,7 +423,7 @@
if (cur->pentities != NULL)
xmlFreeEntitiesTable((xmlEntitiesTablePtr) cur->pentities);
- memset(cur, -1, sizeof(xmlDtd));
+ MEM_CLEANUP(cur, sizeof(xmlDtd));
xmlFree(cur);
}
@@ -485,7 +485,7 @@
if (cur->ids != NULL) xmlFreeIDTable((xmlIDTablePtr) cur->ids);
if (cur->refs != NULL) xmlFreeRefTable((xmlRefTablePtr) cur->refs);
if (cur->URL != NULL) xmlFree((char *) cur->URL);
- memset(cur, -1, sizeof(xmlDoc));
+ MEM_CLEANUP(cur, sizeof(xmlDoc));
xmlFree(cur);
}
@@ -1110,7 +1110,7 @@
xmlRemoveID(cur->parent->doc, cur);
if (cur->name != NULL) xmlFree((char *) cur->name);
if (cur->children != NULL) xmlFreeNodeList(cur->children);
- memset(cur, -1, sizeof(xmlAttr));
+ MEM_CLEANUP(cur, sizeof(xmlAttr));
xmlFree(cur);
}
@@ -2305,7 +2305,7 @@
(cur->name != xmlStringComment))
xmlFree((char *) cur->name);
if (cur->nsDef != NULL) xmlFreeNsList(cur->nsDef);
- memset(cur, -1, sizeof(xmlNode));
+ MEM_CLEANUP(cur, sizeof(xmlNode));
xmlFree(cur);
}
@@ -4511,13 +4511,13 @@
}
if (buf->content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
- memset(buf->content, -1, BASE_BUFFER_SIZE);
+ MEM_CLEANUP(buf->content, BASE_BUFFER_SIZE);
#else
- memset(buf->content, -1, buf->size);
+ MEM_CLEANUP(buf->content, buf->size);
#endif
xmlFree(buf->content);
}
- memset(buf, -1, sizeof(xmlBuffer));
+ MEM_CLEANUP(buf, sizeof(xmlBuffer));
xmlFree(buf);
}
@@ -4531,7 +4531,7 @@
xmlBufferEmpty(xmlBufferPtr buf) {
if (buf->content == NULL) return;
buf->use = 0;
- memset(buf->content, -1, buf->size);/* just for debug */
+ MEM_CLEANUP(buf->content, buf->size);
}
/**