[cl-ppcre-devel] Need help with a slow regexp

Edi Weitz edi at agharta.de
Sun Jan 23 17:51:32 UTC 2005


OK, now these are the results I get with CL-PPCRE 1.1.0:

  * (lisp-implementation-type)

  "SBCL"
  * (lisp-implementation-version)

  "0.8.18.34"
  * *regex-char-code-limit*

  1114112
  * (defun parse-file (file)
      (with-open-file (in file)
        (do ((line (read-line in nil :eof) (read-line in nil :eof)))
            ((eql line :eof) t)
          (do-register-groups ((#'intern host))
              ("^(?:\\S+ ){7}(\\S+)\\s+- commAlarm" line)
              ;; do something other than printing for more accurate TIME
              ;; results
              host))))

  PARSE-FILE
  * (time (parse-file "/tmp/sample50")) ;; your sample, 50 lines

  Evaluation took:
    0.03 seconds of real time
    0.01 seconds of user run time
    0.02 seconds of system run time
    0 page faults and
    519,008 bytes consed.
  T
  * (time (parse-file "/tmp/sample500")) ;; your sample, 500 lines

  Evaluation took:
    0.314 seconds of real time
    0.24 seconds of user run time
    0.07 seconds of system run time
    0 page faults and
    5,194,960 bytes consed.
  T
  * (time (parse-file "/tmp/sample5000")) ;; your sample, 5000 lines

  Evaluation took:
    1.187 seconds of real time
    0.34 seconds of user run time
    0.85 seconds of system run time
    0 page faults and
    51,942,672 bytes consed.
  T

That's better, isn't it?  Thanks for making me aware of this problem.

Cheers,
Edi.




More information about the Cl-ppcre-devel mailing list