freebsd-nq/lib
Daniel C. Sobral 6049d9f0eb Add Boyler-Moore algorithm to pre-matching test.
The BM algorithm works by scanning the pattern from right to left,
and jumping as many characters as viable based on the text's mismatched
character and the pattern's already matched suffix.

This typically enable us to test only a fraction of the text's characters,
but has a worse performance than the straight-forward method for small
patterns. Because of this, the BM algorithm will only be used if the
pattern size is at least 4 characters.

Notice that this pre-matching is done on the largest substring of the
regular expression that _must_ be present on the text for a succesful
match to be possible at all.

For instance, "(xyzzy|grues)" will yield a null "must" substring, and,
therefore, not benefit from the BM algorithm at all. Because of the
lack of intelligence of the algorithm that finds the "must" string,
things like "charjump|matchjump" will also yield a null string. To
optimize that, "(char|match)jump" should be used.

The setup time (at regcomp()) for the BM algorithm will most likely
outweight any benefits for one-time matches. Given the slow regex(3)
we have, this is unlikely to be even perceptible, though.

The size of a regex_t structure is increased by 2*sizeof(char*) +
256*sizeof(int) + strlen(must)*sizeof(int). This is all inside the
regex_t's "guts", which is allocated dynamically by regcomp(). If
allocation of either of the two tables fail, the other one is freed.
In this case, the straight-forward algorithm is used for pre-matching.

Tests exercising the code path affected have shown a speed increase of
50% for "must" strings of length four or five.

API and ABI remain unchanged by this commit.

The patch submitted on the PR was not used, as it was non-functional.

PR: 14342
2000-06-29 04:48:34 +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 Replace beforeinstall target with new variables used by .mk system. 2000-01-14 07:57:47 +00:00
libbind Build more components to get named to build. 1999-11-30 04:40:54 +00:00
libc Add Boyler-Moore algorithm to pre-matching test. 2000-06-29 04:48:34 +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 Replace beforeinstall target with new variables used by .mk system. 2000-01-14 07:57:47 +00:00
libcompat Remove single-space hard sentence breaks. These degrade the quality 2000-03-02 09:14:21 +00:00
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 Handle multiline replies properly, instead of kinda-right. 2000-06-28 15:48:26 +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 $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libio Add functions which allow i/o memory to be accessed without forcing a 2000-02-12 14:57:01 +00:00
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 Make a link from curses.3 -> ncurses.3 so that 'man 3 curses' does 2000-03-02 08:23:23 +00:00
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 Replace beforeinstall target with new variables used by .mk system. 2000-01-14 07:57:47 +00:00
libresolv Don't build elf libresolv.so*, no elf freebsd binaries have used it ever. 1998-10-11 04:21:56 +00:00
librpcsvc $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libskey Introduce .Lb macro to libskey manpage 2000-04-22 16:14:26 +00:00
libss sigset_t change (part 5 of 5) 1999-09-29 15:18:46 +00:00
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 $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
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 $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libz Remove single-space hard sentence breaks. These degrade the quality 2000-03-02 09:14:21 +00:00
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