regcomp.c: Optimize a single Unicode property in a [character class]
authorKarl Williamson <public@khwilliamson.com>
Mon, 28 Nov 2011 19:32:02 +0000 (12:32 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:36 +0000 (09:58 -0700)
commit88d45d285bee142b4f37f62d7260e24504d371e5
tree194c322d82321582b06455e1560b49f7883b5f3b
parentdc415b4a4cd50c68d6d3216ef105f1cbc2e2e266
regcomp.c: Optimize a single Unicode property in a [character class]

All Unicode properties actually turn into bracketed character classes,
whether explicitly done or not.  A swash is generated for each property
in the class.  If that is the only thing not in the class's bitmap, it
specifies completely the non-bitmap behavior of the class, and can be
passed explicitly to regexec.c.  This avoids having to regenerate the
swash.  It also means that the same swash is used for multiple instances
of a property.  And that means the number of duplicated data structures
is greatly reduced.  This currently doesn't extend to cases where
multiple Unicode properties are used in the same class
[\p{greek}\p{latin}] will not share the same swash as another character
class with the same components.  This is because I don't know of a
an efficient method to determine if a new class being parsed has the
same components as one already generated.  I suppose some sort of
checksum could be generated, but that is for future consideration.
regcomp.c
t/lib/warnings/utf8
t/uni/cache.t
utf8.c