[PATCH] Microoptimize regex, take 2
Paolo Bonzini
paolo.bonzini@polimi.it
Wed Mar 24 16:50:00 GMT 2004
Updated ChangeLog:
2004-03-24 Paolo Bonzini <bonzini@gnu.org>
* posix/regex_internal.c (free_state): Free the
word_trtable if it is used.
(re_string_reconstruct, re_string_context_at): Add
several branch predictions for case-sensitive
matching and for no transition table being used.
* posix/regex_internal.h (re_dfastate_t): Turn the
word_trtable from a 1-bit flag into a pointer to a
transition table.
* posix/regexec.c (acquire_init_state_context): Do not
always inline.
* posix/regexec.c (build_trtable): Store the transition
table into state. Return a boolean indicating success.
(transit_state): Check trtable and word_trtable separately,
instead of looking into word_trtable for information about
the trtable's contents. Remove the check for out-of-bounds
buffers.
(check_matching): Check here for out-of-bounds buffers.
(match_ctx_free_subtops): Remove, merge into...
(match_ctx_clean): ... this function.
(match_ctx_free): Call match_ctx_clean.
(re_search_internal): Store into match_kind a set of bits
indicating which incantation of fastmap scanning must be
used. Use a switch statement instead of multiple ifs.
Exit the final "for (;;)" with goto free_return unless
the match succeeded, thus simplifying some conditionals.
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
More information about the Libc-alpha
mailing list