public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW_DM libdm/regex/matcher.c
Date: Thu, 22 Apr 2010 20:35:00 -0000	[thread overview]
Message-ID: <20100422203525.8828.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2010-04-22 20:35:24

Modified files:
	.              : WHATS_NEW_DM 
	libdm/regex    : matcher.c 

Log message:
	Cache bitset locations to speed up _calc_states. (kabi)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.361&r2=1.362
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/regex/matcher.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5

--- LVM2/WHATS_NEW_DM	2010/04/20 22:31:36	1.361
+++ LVM2/WHATS_NEW_DM	2010/04/22 20:35:24	1.362
@@ -1,5 +1,6 @@
 Version 1.02.47 -
 =================================
+  Cache bitset locations to speed up _calc_states.
   Add a regex optimisation pass for shared character prefixes.
   Add dm_bit_and and dm_bitset_equal to libdevmapper.
   Simplify dm_bitset_create.
--- LVM2/libdm/regex/matcher.c	2010/03/25 18:22:04	1.4
+++ LVM2/libdm/regex/matcher.c	2010/04/22 20:35:24	1.5
@@ -212,6 +212,8 @@
 	/* prime the queue */
 	h = t = _create_state_queue(m->scratch, dfa, rx->firstpos);
 	while (h) {
+		int elems, j, idx[h->bits[0]];
+
 		/* pop state off front of the queue */
 		dfa = h->s;
 		dfa_bits = h->bits;
@@ -219,10 +221,17 @@
 
 		/* iterate through all the inputs for this state */
 		dm_bit_clear_all(bs);
+
+		/* Cache list of locations of bits */
+		elems = 0;
+		for (i = dm_bit_get_first(dfa_bits);
+		     i >= 0; i = dm_bit_get_next(dfa_bits, i))
+			idx[elems++] = i;
+
 		for (a = 0; a < 256; a++) {
 			/* iterate through all the states in firstpos */
-			for (i = dm_bit_get_first(dfa_bits);
-			     i >= 0; i = dm_bit_get_next(dfa_bits, i)) {
+			for (j = 0; j < elems; j++) {
+				i = idx[j];
 				if (dm_bit(m->nodes[i]->charset, a)) {
 					if (a == TARGET_TRANS)
 						dfa->final = m->nodes[i]->final;


                 reply	other threads:[~2010-04-22 20:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100422203525.8828.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).