How to bump raw SAX parsing speed from 5.8M/s to 7.4M/s in 4 lines of code:
- parser.c: small but effective parsing speed improvement
Daniel
diff --git a/parser.c b/parser.c
index 60d0e22..007b2e7 100644
--- a/parser.c
+++ b/parser.c
@@ -2449,12 +2449,18 @@
if ((ctxt->token == 0) && (!cdata)) {
in = ctxt->input->cur;
do {
+get_more:
while (((*in >= 0x20) && (*in != '<') &&
(*in != '&') && (*in <= 0x7F)) || (*in == 0x09))
in++;
if (*in == 0xA) {
ctxt->input->line++;
- continue; /* while */
+ in++;
+ while (*in == 0xA) {
+ ctxt->input->line++;
+ in++;
+ }
+ goto get_more;
}
nbchar = in - ctxt->input->cur;
if (nbchar > 0) {