From penguin at ocean.vvo.ru Thu Dec 28 11:14:53 2006 From: penguin at ocean.vvo.ru (Igor Plekhov) Date: Thu, 28 Dec 2006 21:14:53 +1000 Subject: [cl-ppcre-devel] scan's performance Message-ID: <20061228111453.GD3567@ocean.vvo.ru> It is on sbcl-0.9.16 under Linux. WILD> (time (scan (list :sequence :everything "abc") "foobar")) Evaluation took: 0.017 seconds of real time 0.006998 seconds of user run time 0.0 seconds of system run time 1 page fault and 4,456,456 bytes consed. NIL WILD> (time (scan (list :sequence :everything "abc" :everything) "foobar")) Evaluation took: 0.0 seconds of real time 0.0 seconds of user run time 0.0 seconds of system run time 0 page faults and 0 bytes consed. NIL Why so great difference? There must be two :everything around something to the trick to work. PS. Yes, I need a scan pattern generated at run time. With a static pattern it works incredibly fast, as usual. -- Registered Linux User #124759 From edi at agharta.de Thu Dec 28 16:52:18 2006 From: edi at agharta.de (Edi Weitz) Date: Thu, 28 Dec 2006 17:52:18 +0100 Subject: [cl-ppcre-devel] scan's performance In-Reply-To: <20061228111453.GD3567@ocean.vvo.ru> (Igor Plekhov's message of "Thu, 28 Dec 2006 21:14:53 +1000") References: <20061228111453.GD3567@ocean.vvo.ru> Message-ID: On Thu, 28 Dec 2006 21:14:53 +1000, Igor Plekhov wrote: > It is on sbcl-0.9.16 under Linux. > > WILD> (time (scan (list :sequence :everything "abc") > "foobar")) > Evaluation took: > 0.017 seconds of real time > 0.006998 seconds of user run time > 0.0 seconds of system run time > 1 page fault and > 4,456,456 bytes consed. > NIL > > WILD> (time (scan (list :sequence :everything "abc" :everything) > "foobar")) > Evaluation took: > 0.0 seconds of real time > 0.0 seconds of user run time > 0.0 seconds of system run time > 0 page faults and > 0 bytes consed. > NIL > > Why so great difference? Because for the first expression CL-PPCRE realizes that it can add a special test for the constant string "abc" at the end. For the second, it can't. > There must be two :everything around something to the trick to work. > > PS. Yes, I need a scan pattern generated at run time. With a > static pattern it works incredibly fast, as usual. Bind *USE-BMH-MATCHERS* to NIL and you should be set. * (let ((*use-bmh-matchers* nil)) (time (scan (list :sequence :everything "abc") "foobar"))) Evaluation took: 0.0 seconds of real time 0.0 seconds of user run time 0.0 seconds of system run time 0 calls to %EVAL 0 page faults and 0 bytes consed. NIL Cheers, Edi.