freebsd_amp_hwpstate/lib/libc
Daniel C. Sobral e6a886d8db Enhance the optimization provided by pre-matching. Fix style bugs with
previous commits.

At the time we search the pattern for the "must" string, we now compute
the longest offset from the beginning of the pattern at which the must
string might be found. If that offset is found to be infinite (through
use of "+" or "*"), we set it to -1 to disable the heuristics applied
later.

After we are done with pre-matching, we use that offset and the point in
the text at which the must string was found to compute the earliest
point at which the pattern might be found.

Special care should be taken here. The variable "start" is passed to the
automata-processing functions fast() and slow() to indicate the point in
the text at which they should start working from. The real beginning of
the text is passed in a struct match variable m, which is used to check
for anchors. That variable, though, is initialized with "start", so we
must not adjust "start" before "m" is properly initialized.

Simple tests showed a speed increase from 100% to 400%, but they were
biased in that regexec() was called for the whole file instead of line
by line, and parenthized subexpressions were not searched for.

This change adds a single integer to the size of the "guts" structure,
and does not change the ABI.

Further improvements possible:

Since the speed increase observed here is so huge, one intuitive
optimization would be to introduce a bias in the function that computes
the "must" string so as to prefer a smaller string with a finite offset
over a larger one with an infinite offset. Tests have shown this to be a
bad idea, though, as the cost of false pre-matches far outweights the
benefits of a must offset, even in biased situations.

A number of other improvements suggest themselves, though:

	* identify the cases where the pattern is identical to the must
	string, and avoid entering fast() and slow() in these cases.

	* compute the maximum offset from the must string to the end of
	the pattern, and use that to set the point at which fast() and
	slow() should give up trying to find a match, and return then
	return to pre-matching.

	* return all the way to pre-matching if a "match" was found and
	later invalidated by back reference processing. Since back
	references are evil and should be avoided anyway, this is of
	little use.
2000-07-02 10:58:07 +00:00
..
alpha Finish moving all IEEE fp types to be the same on all arch's. 2000-05-10 19:41:40 +00:00
amd64 Use assembler directives rather than ALTENTRY() so that longjmp() and 2000-05-04 04:36:26 +00:00
compat-43 Use `Er' variable to define first column width in ERRORS section. 2000-05-06 12:00:11 +00:00
db Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(), 2000-01-27 23:07:25 +00:00
gen Style fixes. 2000-07-01 17:49:34 +00:00
gmon Introduce ".Lb" macro to libc manpages. 2000-04-21 09:42:15 +00:00
i386 You need options USER_LDT in your kernel to use these functions. 2000-06-14 13:38:21 +00:00
include $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
locale Megre XPG4 code into libc 2000-06-03 12:24:08 +00:00
mips Bring in initial libc support for mips. These files were taken from 1999-03-03 07:06:17 +00:00
mipseb Fix all the mipseb Makefiles. They were broken when I checked them in 1999-04-22 07:16:11 +00:00
mipsel Fix all the mipseb Makefiles. They were broken when I checked them in 1999-04-22 07:16:11 +00:00
net Don't call _getipnodebyname_multi(). It fixes the problem that 2000-06-20 16:33:33 +00:00
nls Introduce ".Lb" macro to libc manpages. 2000-04-21 09:42:15 +00:00
posix1e - Replace ``.Va (cap_t)NULL'' with ``.Dv NULL'' 2000-06-09 02:01:27 +00:00
quad $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
regex Enhance the optimization provided by pre-matching. Fix style bugs with 2000-07-02 10:58:07 +00:00
rpc Replace structure copy form ifreq obtained by SIOCGIFADDR 2000-03-03 13:05:00 +00:00
stdio Use `Er' variable to define first column width in ERRORS section. 2000-05-06 12:07:59 +00:00
stdlib bring in binary search tree code. 2000-07-01 06:55:11 +00:00
stdtime Fix assigning alt_month in compatibility code 2000-06-29 17:21:45 +00:00
string Introduce ".Lb" macro to libc manpages. 2000-04-21 09:42:15 +00:00
sys change first release date to 4.1-R as 5.0-R won't be out for at least a 2000-06-26 21:23:57 +00:00
xdr Do proper byte swapping in 64bit routines. 2000-04-12 08:41:16 +00:00
yp Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(), 2000-01-27 23:07:25 +00:00
Makefile sigset_t change (part 5 of 5) 1999-09-29 15:18:46 +00:00
Makefile.inc $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00