FreeBSD src
Go to file
dcs 6976417416 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
bin Various cleanups are made to reduce warnings and make code prettier :) 2000-07-01 05:36:25 +00:00
contrib Change $FreeBSD$ placement. 2000-06-26 23:03:37 +00:00
crypto So /this/ is what has made OpenSSH's SSHv2 support never work right! 2000-06-27 21:16:06 +00:00
etc Update cons* entries from termcap 2000-06-30 14:01:49 +00:00
games add a real prototype for printit() 2000-06-30 03:17:42 +00:00
gnu Fix manpath for new perl 2000-07-02 03:17:31 +00:00
include Add URI encoding to the vis/unvis routines courtesy of VIS_HTTPSTYLE. 2000-07-01 15:55:49 +00:00
kerberos5 Properly separate the K5-only buld from K4. 2000-03-23 14:56:47 +00:00
kerberosIV Remove the last vestiges of libRSAglue now that it's an empty stub. 2000-03-11 22:34:10 +00:00
lib Enhance the optimization provided by pre-matching. Fix style bugs with 2000-07-02 10:58:07 +00:00
libexec Only punctuation is an allowed argument type for open-close macros 2000-06-30 06:30:53 +00:00
release - Build modules with world so that modules are back in the bin dist. 2000-07-01 21:48:05 +00:00
sbin Print the correct speed when speed is less than 1MB/s. 2000-07-01 21:28:49 +00:00
secure MFI. This is a documentation-only, diffreducing patch, that if 2000-06-24 06:50:58 +00:00
share Use consistent markup for literals and quoted metasyntactic variables. 2000-06-30 15:59:48 +00:00
sys Modify ktrace's general I/O tracing, ktrgenio(), to use a struct uio * 2000-07-02 08:08:09 +00:00
tools Back out the previous change to the queue(3) interface. 2000-05-26 02:09:24 +00:00
usr.bin fix fd leak by close(fd) at end of loop. 2000-07-02 03:34:08 +00:00
usr.sbin Call login_close() to prevent parent from memory leaking in some 2000-07-02 04:15:15 +00:00
COPYRIGHT Update to add the July 22, 1999 addendum. 1999-09-05 21:33:47 +00:00
Makefile We have a new world order in libraries. 2000-02-24 23:03:16 +00:00
Makefile.inc1 Rearrange Perl's build priority; it needs to get made earlier. 2000-06-25 15:02:18 +00:00
Makefile.upgrade $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
README $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
UPDATING Note des' libfetch/fetch changes. 2000-06-30 17:19:07 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel and the contents of /etc.  Please see the top of the Makefile
in this directory for more information on the standard build targets
and compile-time flags.

Building a kernel with config(8) is a somewhat more involved process,
documentation for which can be found at:
   http://www.freebsd.org/handbook/kernelconfig.html
And in the config(8) man page.

The sample kernel configuration files reside in the sys/i386/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file LINT contains entries for all possible devices, not
just those commonly used, and is meant more as a general reference
than an actual kernel configuration file (a kernel built from it
wouldn't even run).


Source Roadmap:
---------------
bin		System/User commands.

contrib		Packages contributed by 3rd parties.

crypto		Export controlled stuff (see crypto/README).

etc		Template files for /etc

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberosIV	Kerberos package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

sbin		System commands.

secure		DES and DES-related utilities - NOT FOR EXPORT!

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/handbook/synching.html