logo       

CVS: sbcl/src/compiler seqtran.lisp,1.50,1.51: msg#00036

Subject: CVS: sbcl/src/compiler seqtran.lisp,1.50,1.51
Update of /cvsroot/sbcl/sbcl/src/compiler
In directory sc8-pr-cvs1:/tmp/cvs-serv11215/src/compiler

Modified Files:
        seqtran.lisp 
Log Message:
0.8.7.15:
        Benchmark-inspired SEARCH deftransform for simple-base-strings
        ... Adjust per APD sbcl-devel to allow the type deriver to
                work out all the types
        ... put boyer-moore version in compiler-extras in contrib/
        Also fix stale-symbols so that it runs
        ... most stale symbols appear to be within vop-parse and
                pv-table structures


Index: seqtran.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/seqtran.lisp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- seqtran.lisp        16 Sep 2003 07:45:10 -0000      1.50
+++ seqtran.lisp        14 Jan 2004 16:53:17 -0000      1.51
@@ -712,6 +712,32 @@
                            sb!vm:n-byte-bits)))
      string1))
 
+;;; FIXME: this would be a valid transform for certain excluded cases:
+;;;   * :TEST 'CHAR= or :TEST #'CHAR=
+;;;   * :TEST 'EQL   or :TEST #'EQL
+;;;   * :FROM-END NIL (or :FROM-END non-NIL, with a little ingenuity)
+;;;
+;;; also, it should be noted that there's nothing much in this
+;;; transform (as opposed to the ones for REPLACE and CONCATENATE)
+;;; that particularly limits it to SIMPLE-BASE-STRINGs.
+(deftransform search ((pattern text &key (start1 0) (start2 0) end1 end2)
+                     (simple-base-string simple-base-string &rest t)
+                     *
+                     :policy (> speed (max space safety)))
+  `(block search
+    (let ((end1 (or end1 (length pattern)))
+         (end2 (or end2 (length text))))
+      (do ((index2 start2 (1+ index2)))
+         ((>= index2 end2) nil)
+       (when (do ((index1 start1 (1+ index1))
+                  (index2 index2 (1+ index2)))
+                 ((>= index1 end1) t)
+               (when (= index2 end2)
+                 (return-from search nil))
+               (when (char/= (char pattern index1) (char text index2))
+                 (return nil)))
+         (return index2))))))
+
 ;;; FIXME: It seems as though it should be possible to make a DEFUN
 ;;; %CONCATENATE (with a DEFTRANSFORM to translate constant RTYPE to
 ;;; CTYPE before calling %CONCATENATE) which is comparably efficient,



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe