aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Makefile.am24
-rwxr-xr-xdbgen.pl43
-rwxr-xr-xdbgenattr.pl42
-rw-r--r--xmlreader.c3
5 files changed, 116 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6dfcaf04..28f9311d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Sep 18 00:31:02 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+ * Makefile.am: add a Timingtests target to check bad behaviour
+ from the streaming engine
+ * dbgen.pl dbgenattr.pl: perl script to generate big instances
+ * xmlreader.c: fix a bad behaviour on large buffer inputs
+
Wed Sep 17 23:25:47 CEST 2003 Daniel Veillard <daniel@veillard.com>
* dict.c xmlreader.c: two small improvements
diff --git a/Makefile.am b/Makefile.am
index 6fd1879d..4f3f04b0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -120,7 +120,7 @@ check-local: tests
testall : tests SVGtests SAXtests
-tests: XMLtests XMLenttests NStests Readertests SAXtests HTMLtests Validtests URItests XPathtests XPtrtests XIncludetests C14Ntests Scripttests Catatests @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@
+tests: XMLtests XMLenttests NStests Readertests SAXtests HTMLtests Validtests URItests XPathtests XPtrtests XIncludetests C14Ntests Scripttests Catatests @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests
@(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; $(MAKE) tests ; fi)
valgrind:
@@ -699,6 +699,24 @@ Automatatests: testAutomata$(EXEEXT)
rm result.$$name ; \
fi ; fi ; done)
+$(srcdir)/dba100000.xml: dbgenattr.pl
+ @echo "## generating dba100000.xml"
+ @(dbgenattr.pl 100000 > $(srcdir)/dba100000.xml)
+
+Timingtests: $(srcdir)/dba100000.xml
+ @echo "##"
+ @echo "## Timing tests to try to detect performance"
+ @echo "## as well a memory usage breakage when streaming"
+ @echo "## first when using the file interface"
+ @echo "## then when using the memory interface"
+ @echo "##"
+ -@(xmllint --stream --timing $(srcdir)/dba100000.xml; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
+ exit 0)
+ -@(xmllint --stream --timing --memory $(srcdir)/dba100000.xml; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
+ exit 0)
+
C14Ntests : testC14N$(EXEEXT)
@echo "##"
@echo "## C14N and XPath regression tests"
@@ -869,7 +887,9 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
$(man_MANS) libxml-2.0.pc.in \
trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
triop.h triodef.h libxml.h \
- testThreadsWin32.c genUnicode.py TODO_SCHEMAS
+ testThreadsWin32.c genUnicode.py TODO_SCHEMAS \
+ dbgen.pl dbgenattr.pl
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libxml-2.0.pc
diff --git a/dbgen.pl b/dbgen.pl
new file mode 100755
index 00000000..1383d6e9
--- /dev/null
+++ b/dbgen.pl
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+
+$size = shift;
+
+if ($size eq "")
+{
+ die "usage: dbgen.pl [size]\n";
+}
+
+@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood",
+ "George", "Hank", "Inki", "James");
+@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman",
+ "Franklin", "Grice", "Haverford", "Ilvedson", "Jones");
+@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
+ "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
+ "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
+ "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
+ "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
+
+print "<?xml version=\"1.0\"?>\n";
+print "\n";
+print "<table>\n";
+
+for ($i=0; $i<$size; $i++)
+{
+ $first = $firstnames [$i % 10];
+ $last = $lastnames [($i / 10) % 10];
+ $state = $states [($i / 100) % 50];
+ $zip = 22000 + $i / 5000;
+
+ printf " <row>\n";
+ printf " <id>%04d</id>\n", $i;
+ printf " <firstname>$first</firstname>\n", $i;
+ printf " <lastname>$last</lastname>\n", $i;
+ printf " <street>%d Any St.</street>\n", ($i % 100) + 1;
+ printf " <city>Anytown</city>\n";
+ printf " <state>$state</state>\n";
+ printf " <zip>%d</zip>\n", $zip;
+ printf " </row>\n";
+}
+
+print "</table>\n";
+
diff --git a/dbgenattr.pl b/dbgenattr.pl
new file mode 100755
index 00000000..dce11cd8
--- /dev/null
+++ b/dbgenattr.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+$size = shift;
+
+if ($size eq "")
+{
+ die "usage: dbgen.pl [size]\n";
+}
+
+@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood",
+ "George", "Hank", "Inki", "James");
+@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman",
+ "Franklin", "Grice", "Haverford", "Ilvedson", "Jones");
+@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
+ "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
+ "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
+ "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
+ "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
+
+print "<?xml version=\"1.0\"?>\n";
+print "\n";
+print "<table>\n";
+
+for ($i=0; $i<$size; $i++)
+{
+ $first = $firstnames [$i % 10];
+ $last = $lastnames [($i / 10) % 10];
+ $state = $states [($i / 100) % 50];
+ $zip = 22000 + $i / 5000;
+
+ printf " <row\n";
+ printf " id='%04d'\n", $i;
+ printf " firstname='$first'\n", $i;
+ printf " lastname='$last'\n", $i;
+ printf " street='%d Any St.'\n", ($i % 100) + 1;
+ printf " city='Anytown'\n";
+ printf " state='$state'\n";
+ printf " zip='%d'/>\n", $zip;
+}
+
+print "</table>\n";
+
diff --git a/xmlreader.c b/xmlreader.c
index 30451b43..95920080 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -803,7 +803,8 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
* Discard the consumed input when needed and possible
*/
if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
- if (reader->cur >= 4096) {
+ if ((reader->cur >= 4096) &&
+ (inbuf->use - reader->cur <= CHUNK_SIZE)) {
val = xmlBufferShrink(inbuf, reader->cur);
if (val >= 0) {
reader->cur -= val;