freebsd_amp_hwpstate/lib
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
..
compat add libxpg4 2000-06-14 14:38:11 +00:00
csu Use the new machine-independent versions of crtbegin and crtend 2000-05-24 02:17:12 +00:00
libalias Fixed PunchFWHole(): 2000-06-27 14:56:07 +00:00
libatm
libbind
libc Enhance the optimization provided by pre-matching. Fix style bugs with 2000-07-02 10:58:07 +00:00
libc_r Fix typo in SEE ALSO section. 2000-06-28 03:15:21 +00:00
libcalendar Introduce .Lb macro to libcalendar manpage. 2000-04-22 15:51:37 +00:00
libcam Fix groff confusion for PS output. 2000-06-20 10:53:51 +00:00
libcom_err
libcompat
libcrypt Oops, remove vestigial reference to SHS passwords. 2000-04-22 20:43:21 +00:00
libdevstat Introduce .Lb macro to libdevstat library manpage 2000-04-22 15:58:01 +00:00
libdisk _PATH_DEV'ify libdisk 2000-06-28 22:28:50 +00:00
libedit <blush> I tested the real code changes, but neglected to test the 2000-05-22 06:01:31 +00:00
libfetch Make restart work in active mode, too. 2000-06-29 10:44:10 +00:00
libform Add missing source files. Sort SRCS. 2000-05-24 09:01:23 +00:00
libftpio Put the FTP_PASSIVE_MODE issue to rest once and for all. 2000-05-05 17:02:32 +00:00
libgnumalloc
libio
libipsec Fix typo. 2000-05-06 14:07:35 +00:00
libipx Introduce .Lb macro to libipx library manpage 2000-04-22 16:01:01 +00:00
libkse If multiple threads are blocked in sigwait() for the same signal that does 2000-06-27 21:30:16 +00:00
libkvm Remove obsolete reference to /var/db/kvm_kernel.db 2000-05-07 02:16:43 +00:00
libm Disconnect libm from the build tree. It's broken, not being 2000-05-02 14:16:19 +00:00
libmd Introduce .Lb macro to libmd manpages 2000-04-22 16:11:30 +00:00
libmenu Add missing source files. Sort SRCS. 2000-05-24 09:01:23 +00:00
libncp Back out the previous change to the queue(3) interface. 2000-05-26 02:09:24 +00:00
libncurses
libnetgraph - Make sure the message token returned by NgSendMsg() is non-negative 2000-06-21 23:01:07 +00:00
libopie Add some extra functions adapted from OpenBSD, in preparation for 2000-05-15 04:20:54 +00:00
libpam Update to the version of pam_ssh corresponding to OpenSSH 2.1 (taken 2000-05-30 09:03:15 +00:00
libpanel Add missing source files. Sort SRCS. 2000-05-24 09:01:23 +00:00
libpcap Don't try to compile in INET6 support when NOINET6 is defined. 2000-04-15 20:45:52 +00:00
libposix1e - Replace ``.Va (cap_t)NULL'' with ``.Dv NULL'' 2000-06-09 02:01:27 +00:00
libpthread Fix typo in SEE ALSO section. 2000-06-28 03:15:21 +00:00
libradius
libresolv
librpcsvc
libskey Introduce .Lb macro to libskey manpage 2000-04-22 16:14:26 +00:00
libss
libstand Back out the previous change to the queue(3) interface. 2000-05-26 02:09:24 +00:00
libtacplus Supply only one author name per instance of %A, as per mdoc.samples(7). 2000-05-10 09:49:04 +00:00
libtelnet
libusb The USB library from NetBSD by Lennart Augustsson <lennart@augustsson.net>. 2000-06-11 18:19:14 +00:00
libusbhid The USB library from NetBSD by Lennart Augustsson <lennart@augustsson.net>. 2000-06-11 18:19:14 +00:00
libutil document sbsize limit. 2000-06-02 20:51:05 +00:00
libvgl Introduce .Lb macro to libvgl manpage 2000-04-22 16:17:38 +00:00
libwrap Don't try to compile in INET6 support when NOINET6 is defined. 2000-04-15 20:45:52 +00:00
libxpg4 Bump major to preserve 3.x binaries compatibility 2000-06-13 00:41:38 +00:00
liby
libz
msun Removed bogus 'l' suffixes in FP register to register instructions. 2000-06-06 12:12:36 +00:00
ncurses Add missing source files. Sort SRCS. 2000-05-24 09:01:23 +00:00
Makefile Disconnect libm from the build tree. It's broken, not being 2000-05-02 14:16:19 +00:00
Makefile.inc