Old but effective optimization patch:

- parser.c parserInternals.c: applied Bjorn Reese optimization patch
Daniel
This commit is contained in:
Daniel Veillard 2001-01-06 21:09:34 +00:00
parent 503b89361d
commit 167bd53151
4 changed files with 116 additions and 85 deletions

View File

@ -1,3 +1,12 @@
Sat Jan 6 22:05:09 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* parser.c parserInternals.c: applied Bjorn Reese optimization
patch
Sat Jan 6 19:13:27 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* Makefile.am: applied patch fro make check from Martin Vidner
Thu Jan 4 19:07:49 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Thu Jan 4 19:07:49 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* configure.in: preparing 2.2.11 * configure.in: preparing 2.2.11

View File

@ -95,14 +95,14 @@ HTMLtests : testHTML
if [ ! -d $$i ] ; then \ if [ ! -d $$i ] ; then \
if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
echo New test file $$name ; \ echo New test file $$name ; \
testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \ $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
else \ else \
echo Testing $$name ; \ echo Testing $$name ; \
testHTML $$i > result.$$name 2> error.$$name ; \ $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/HTML/$$name result.$$name ; \ diff $(srcdir)/result/HTML/$$name result.$$name ; \
diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \ diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \
testHTML result.$$name > result2.$$name 2>error.$$name ; \ $(top_builddir)/testHTML result.$$name > result2.$$name 2>error.$$name ; \
diff result.$$name result2.$$name ; \ diff result.$$name result2.$$name ; \
rm result.$$name result2.$$name error.$$name ; \ rm result.$$name result2.$$name error.$$name ; \
fi ; fi ; done) fi ; fi ; done)
@ -114,16 +114,16 @@ HTMLtests : testHTML
if [ ! -d $$i ] ; then \ if [ ! -d $$i ] ; then \
if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
echo New test file $$name ; \ echo New test file $$name ; \
testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \ $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
else \ else \
echo Testing $$name ; \ echo Testing $$name ; \
testHTML --push $$i > result.$$name 2> error.$$name ; \ $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/HTML/$$name result.$$name ; \ diff $(srcdir)/result/HTML/$$name result.$$name ; \
cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \ cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \
cut -b 1-15 error.$$name > errorcut2.$$name; \ cut -b 1-15 error.$$name > errorcut2.$$name; \
diff -b errorcut.$$name errorcut2.$$name ; \ diff -b errorcut.$$name errorcut2.$$name ; \
testHTML --push result.$$name > result2.$$name 2>error.$$name ; \ $(top_builddir)/testHTML --push result.$$name > result2.$$name 2>error.$$name ; \
diff result.$$name result2.$$name ; \ diff result.$$name result2.$$name ; \
rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \ rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \
fi ; fi ; done) fi ; fi ; done)
@ -135,10 +135,10 @@ HTMLtests : testHTML
if [ ! -d $$i ] ; then \ if [ ! -d $$i ] ; then \
if [ ! -f $(srcdir)/result/HTML/$$name.sax ] ; then \ if [ ! -f $(srcdir)/result/HTML/$$name.sax ] ; then \
echo New test file $$name ; \ echo New test file $$name ; \
testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \ $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
else \ else \
echo Testing $$name ; \ echo Testing $$name ; \
testHTML --sax $$i > result.$$name.sax ; \ $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax ; \ diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax ; \
rm result.$$name.sax ; \ rm result.$$name.sax ; \
@ -151,10 +151,10 @@ HTMLtests : testHTML
if [ ! -d $$i ] ; then \ if [ ! -d $$i ] ; then \
if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
echo New test file $$name ; \ echo New test file $$name ; \
testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \ $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
else \ else \
echo Testing $$name ; \ echo Testing $$name ; \
testHTML --push --sax $$i > result.$$name.sax ; \ $(top_builddir)/testHTML --push --sax $$i > result.$$name.sax ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax ; \ diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax ; \
rm result.$$name.sax ; \ rm result.$$name.sax ; \
@ -162,6 +162,7 @@ HTMLtests : testHTML
XMLtests : xmllint XMLtests : xmllint
@(rm -f .memdump ; touch .memdump)
@echo "##" @echo "##"
@echo "## XML regression tests" @echo "## XML regression tests"
@echo "##" @echo "##"
@ -199,6 +200,7 @@ XMLtests : xmllint
fi ; fi ; done) fi ; fi ; done)
XMLenttests : xmllint XMLenttests : xmllint
@(rm -f .memdump ; touch .memdump)
@echo "##" @echo "##"
@echo "## XML entity subst regression tests" @echo "## XML entity subst regression tests"
@echo "##" @echo "##"

View File

@ -2092,7 +2092,8 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
buf[len++] = *current++; buf[len++] = *current++;
} }
ctxt->token = 0; ctxt->token = 0;
} else if ((c == '&') && (NXT(1) == '#')) { } else if (c == '&') {
if (NXT(1) == '#') {
int val = xmlParseCharRef(ctxt); int val = xmlParseCharRef(ctxt);
if (val == '&') { if (val == '&') {
/* /*
@ -2111,7 +2112,7 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
} else { } else {
len += xmlCopyChar(0, &buf[len], val); len += xmlCopyChar(0, &buf[len], val);
} }
} else if (c == '&') { } else {
ent = xmlParseEntityRef(ctxt); ent = xmlParseEntityRef(ctxt);
if ((ent != NULL) && if ((ent != NULL) &&
(ctxt->replaceEntities != 0)) { (ctxt->replaceEntities != 0)) {
@ -2162,6 +2163,7 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
buf[len++] = *cur++; buf[len++] = *cur++;
buf[len++] = ';'; buf[len++] = ';';
} }
}
} else { } else {
if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) { if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) {
COPY_BUF(l,buf,len,0x20); COPY_BUF(l,buf,len,0x20);

View File

@ -428,15 +428,30 @@ xmlIsBlank(int c) {
* *
* Returns 0 if not, non-zero otherwise * Returns 0 if not, non-zero otherwise
*/ */
static int xmlBaseArray[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0000 - 0x000F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 - 0x001F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0020 - 0x002F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0030 - 0x003F */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x0040 - 0x004F */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x0050 - 0x005F */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x0060 - 0x006F */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x0070 - 0x007F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0080 - 0x008F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0090 - 0x009F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00A0 - 0x00AF */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00B0 - 0x00BF */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00C0 - 0x00CF */
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00D0 - 0x00DF */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00E0 - 0x00EF */
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00F0 - 0x00FF */
};
int int
xmlIsBaseChar(int c) { xmlIsBaseChar(int c) {
return( return(
(((c) >= 0x0041) && ((c) <= 0x005A)) || (((c) < 0x0100) ? xmlBaseArray[c] :
(((c) >= 0x0061) && ((c) <= 0x007A)) || ( /* accelerator */
(((c) >= 0x00C0) && ((c) <= 0x00D6)) ||
(((c) >= 0x00D8) && ((c) <= 0x00F6)) ||
(((c) >= 0x00F8) && ((c) <= 0x00FF)) ||
(((c) >= 0x100) && ( /* accelerator */
(((c) >= 0x0100) && ((c) <= 0x0131)) || (((c) >= 0x0100) && ((c) <= 0x0131)) ||
(((c) >= 0x0134) && ((c) <= 0x013E)) || (((c) >= 0x0134) && ((c) <= 0x013E)) ||
(((c) >= 0x0141) && ((c) <= 0x0148)) || (((c) >= 0x0141) && ((c) <= 0x0148)) ||
@ -794,13 +809,16 @@ xmlIsCombining(int c) {
*/ */
int int
xmlIsExtender(int c) { xmlIsExtender(int c) {
return( switch (c) {
((c) == 0xb7) || ((c) == 0x2d0) || ((c) == 0x2d1) || case 0x00B7: case 0x02D0: case 0x02D1: case 0x0387:
((c) == 0x387) || ((c) == 0x640) || ((c) == 0xe46) || case 0x0640: case 0x0E46: case 0x0EC6: case 0x3005:
((c) == 0xec6) || ((c) == 0x3005) || case 0x3031: case 0x3032: case 0x3033: case 0x3034:
(((c) >= 0x3031) && ((c) <= 0x3035)) || case 0x3035: case 0x309D: case 0x309E: case 0x30FC:
(((c) >= 0x309b) && ((c) <= 0x309e)) || case 0x30FE:
(((c) >= 0x30fc) && ((c) <= 0x30fe))); return 1;
default:
return 0;
}
} }
/** /**
@ -814,7 +832,7 @@ xmlIsExtender(int c) {
*/ */
int int
xmlIsIdeographic(int c) { xmlIsIdeographic(int c) {
return( return(((c) < 0x0100) ? 0 :
(((c) >= 0x4e00) && ((c) <= 0x9fa5)) || (((c) >= 0x4e00) && ((c) <= 0x9fa5)) ||
(((c) >= 0xf900) && ((c) <= 0xfa2d)) || (((c) >= 0xf900) && ((c) <= 0xfa2d)) ||
(((c) >= 0x3021) && ((c) <= 0x3029)) || (((c) >= 0x3021) && ((c) <= 0x3029)) ||