From eccabfea120debfadad1550390eaae8176b271a5 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 29 Jan 2009 21:41:08 -0600 Subject: [PATCH 01/10] Making XML 30% faster --- basis/xml/char-classes/char-classes.factor | 7 +- basis/xml/errors/errors-tests.factor | 14 +-- basis/xml/state/state.factor | 6 +- basis/xml/tests/state-parser-tests.factor | 2 +- basis/xml/tokenize/tokenize.factor | 114 ++++++++++++--------- 5 files changed, 84 insertions(+), 59 deletions(-) diff --git a/basis/xml/char-classes/char-classes.factor b/basis/xml/char-classes/char-classes.factor index b47d4c66df..d510c8a881 100644 --- a/basis/xml/char-classes/char-classes.factor +++ b/basis/xml/char-classes/char-classes.factor @@ -1,6 +1,7 @@ -! Copyright (C) 2005, 2007 Daniel Ehrenberg +! Copyright (C) 2005, 2009 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences unicode.syntax math math.order combinators ; +USING: kernel sequences unicode.syntax math math.order combinators +hints ; IN: xml.char-classes CATEGORY: 1.0name-start* Ll Lu Lo Lt Nl \u000559\u0006E5\u0006E6_: ; @@ -31,3 +32,5 @@ CATEGORY: 1.1name-char Ll Lu Lo Lm Ln Nl Mc Mn Nd Pc Cf _-.\u0000b7: ; { [ dup HEX: E000 < ] [ drop f ] } [ { HEX: FFFE HEX: FFFF } member? not ] } cond ; + +HINTS: text? { object fixnum } ; diff --git a/basis/xml/errors/errors-tests.factor b/basis/xml/errors/errors-tests.factor index 4204979941..8a469bc08f 100644 --- a/basis/xml/errors/errors-tests.factor +++ b/basis/xml/errors/errors-tests.factor @@ -6,11 +6,11 @@ IN: xml.errors.tests '[ _ string>xml ] swap '[ _ = ] must-fail-with ; T{ no-entity f 1 10 "nbsp" } " " xml-error-test -T{ mismatched f 1 8 T{ name f "" "x" "" } T{ name f "" "y" "" } } +T{ mismatched f 1 7 T{ name f "" "x" "" } T{ name f "" "y" "" } } "" xml-error-test -T{ unclosed f 1 4 V{ T{ name f "" "x" "" } } } "" xml-error-test +T{ unclosed f 1 3 V{ T{ name f "" "x" "" } } } "" xml-error-test T{ nonexist-ns f 1 5 "x" } "" xml-error-test -T{ unopened f 1 5 } "" xml-error-test +T{ unopened f 1 4 } "" xml-error-test T{ not-yes/no f 1 41 "maybe" } "" xml-error-test T{ extra-attrs f 1 32 V{ T{ name f "" "foo" f } } @@ -19,13 +19,13 @@ T{ bad-version f 1 28 "5 million" } "" xml-error-test T{ notags f } "" xml-error-test T{ multitags } "" xml-error-test -T{ bad-prolog f 1 26 T{ prolog f "1.0" "UTF-8" f } } +T{ bad-prolog f 1 25 T{ prolog f "1.0" "UTF-8" f } } "" xml-error-test T{ capitalized-prolog f 1 6 "XmL" } "" xml-error-test T{ pre/post-content f "x" t } "x" xml-error-test T{ versionless-prolog f 1 8 } "" xml-error-test -T{ unclosed-quote f 1 13 } "" xml-error-test T{ bad-name f 1 3 "-" } "<-/>" xml-error-test T{ quoteless-attr f 1 12 } "/>" xml-error-test T{ quoteless-attr f 1 10 } "" xml-error-test @@ -37,6 +37,6 @@ T{ bad-cdata f 1 7 } "" xml-error-test T{ pre/post-content f "&" t } " " xml-error-test T{ bad-doctype f 1 17 "a" } "" xml-error-test T{ bad-doctype f 1 22 T{ opener { name T{ name f "" "foo" "" } } { attrs T{ attrs } } } } " ]>" xml-error-test -T{ disallowed-char f 1 3 1 } "\u000001" xml-error-test -T{ missing-close f 1 9 } "