add a Timingtests target to check bad behaviour from the streaming engine

* 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
Daniel
This commit is contained in:
Daniel Veillard 2003-09-17 22:33:22 +00:00
parent ccc4d2b62e
commit f6bc7c249e
5 changed files with 116 additions and 3 deletions

View File

@ -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

View File

@ -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

43
dbgen.pl Executable file
View File

@ -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";

42
dbgenattr.pl Executable file
View File

@ -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";

View File

@ -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;