Pushed major rewrite of all replace stuff to common-lisp.net.
Changed my simple benchmarks from being several orders of magnitude slower than cl-ppcre to being much faster than cl-ppcre.
(defun bench (n &key (convertor 'identity)) (let ((s (make-string n))) (loop for i below n by 2 do (setf (char s i) #\r)) (let ((s (funcall convertor s))) (time (cl-irregsexp:match-replace-all s ("r" "replaced"))))))
(defun bench-no-replace (n &key (convertor 'identity)) (let ((s (make-string n))) (loop for i below n by 2 do (setf (char s i) #\r)) (let ((s (funcall convertor s))) (eq s (time (cl-irregsexp:match-replace-one s ("q" "replaced")))))))
(defun bench-cl-ppcre (n) (let ((s (make-string n))) (loop for i below n by 2 do (setf (char s i) #\r)) (time (cl-ppcre:regex-replace-all "r" s "replaced"))))
(defun bench-cl-ppcre-no-replace (n) (let ((s (make-string n))) (loop for i below n by 2 do (setf (char s i) #\r)) (time (cl-ppcre:regex-replace-all "q" s "replaced"))))
There is a worrying bug (in SBCL?) that blows up like this in the find-random test. Guess that should be isolated, but everything seems fine on ClozureCL so . . .
failed AVER: (ZEROP (HASH-TABLE-COUNT #)) This is probably a bug in SBCL itself. (Alternatively, SBCL might have been corrupted by bad user code, e.g. by an undefined Lisp operation like (FMAKUNBOUND 'COMPILE), or by stray pointers from alien code or from unsafe Lisp code; or there might be a bug in the OS or hardware that SBCL is running on.) If it seems to be a bug in SBCL itself, the maintainers would like to know about it. Bug reports are welcome on the SBCL mailing lists, which you can find at http://sbcl.sourceforge.net/. [Condition of type SB-INT:BUG]
Restarts: 0: [RETEST] Rerun the test #<IT.BESE.FIVEAM::TEST-CASE CL-IRREGSEXP::FIND-RANDOM {1004B5FD21}> 1: [IGNORE] Signal an exceptional test failure and abort the test #<IT.BESE.FIVEAM::TEST-CASE CL-IRREGSEXP::FIND-RANDOM {1004B5FD21}>. 2: [EXPLAIN] Ignore the rest of the tests and explain current results 3: [RETRY] Retry SLIME REPL evaluation request. 4: [ABORT] Return to SLIME's top level. 5: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {1003168441}>)
Backtrace: 0: (SB-INT:BUG "~@<failed AVER: ~2I~_~A~:>")[:EXTERNAL] 1: (SB-IMPL::%FAILED-AVER (ZEROP (HASH-TABLE-COUNT (SB-C::CORE-OBJECT-PATCH-TABLE SB-C::OBJECT)))) 2: (SB-C::FIX-CORE-SOURCE-INFO #<SB-C::SOURCE-INFO > #<SB-C::CORE-OBJECT > #<FUNCTION (LAMBDA #) {10032A1089}>) 3: (SB-C::%COMPILE ..)[:EXTERNAL]
[...]
cl-irregsexp-devel@common-lisp.net