From attila.lendvai at gmail.com Mon Sep 28 22:48:53 2009 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Tue, 29 Sep 2009 00:48:53 +0200 Subject: [cl-irregsexp-devel] a new user with some questions Message-ID: hi! i've started to play around with cl-irregsexp and its performance is great! i have a few suggestions/questions: - why not use alexandria instead of cl-utilities? it is the quasi standard cl util lib and it has both #:with-unique-names and #:once-only. - why depend on iter? seems like it is used at only place. i'll set up a git repo with a branch for easy cherry-picking my changes and will get back to you with the repo link (once our site is back up again). -- attila From john at fremlin.org Tue Sep 29 04:51:52 2009 From: john at fremlin.org (John Fremlin) Date: Tue, 29 Sep 2009 04:51:52 +0000 Subject: [cl-irregsexp-devel] a new user with some questions In-Reply-To: (Attila Lendvai's message of "Tue, 29 Sep 2009 00:48:53 +0200") References: Message-ID: <87ws3imjyv.fsf-genuine-vii@john.fremlin.org> Hi Attila, Really appreciate you getting in touch. It's great to have someone using cl-irregsexp! Attila Lendvai writes: > i've started to play around with cl-irregsexp and its performance is > great! I'm sure it could be improved (especially compilation) . . . any case where you wanted better performance would be great to hear about. > i have a few suggestions/questions: > > - why not use alexandria instead of cl-utilities? it is the quasi > standard cl util lib and it has both #:with-unique-names and > #:once-only. Thanks for spotting that. I made cl-irregsexp before I found out about Alexandria. To show willing, I have changed it and pushed. > - why depend on iter? seems like it is used at only place. If you don't like iter and can cleanly replace that place (match-replace-all?) with another way of doing it, then I would be happy to drop the dependency. > i'll set up a git repo with a branch for easy cherry-picking my > changes and will get back to you with the repo link (once our site is > back up again). Please do! I eagerly await it! From attila.lendvai at gmail.com Wed Sep 30 14:08:38 2009 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Wed, 30 Sep 2009 16:08:38 +0200 Subject: [cl-irregsexp-devel] a new user with some questions In-Reply-To: <87ws3imjyv.fsf-genuine-vii@john.fremlin.org> References: <87ws3imjyv.fsf-genuine-vii@john.fremlin.org> Message-ID: > To show willing, I have changed it and pushed. great, thanks! >> i'll set up a git repo with a branch for easy cherry-picking my >> changes and will get back to you with the repo link (once our site is >> back up again). ok, our branch is available at http://dwim.hu/gitweb/gitweb.cgi or at git clone http://dwim.hu/git/cl-irregsexp there are only some small things in there for now, but i'll drop a note here on the list if we have something new. if you have any feedback about the changes, then feel free to send them through the list and i'll amend my patches. or just feel free to pull them and shape them for your liking in another patch. -- attila From attila.lendvai at gmail.com Wed Sep 30 15:07:03 2009 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Wed, 30 Sep 2009 17:07:03 +0200 Subject: [cl-irregsexp-devel] some smaller patches Message-ID: please find them attached until our server hosting becomes more stable. meanwhile gitweb is available at: http://dwim.hu/gitweb/gitweb.cgi?p=cl-irregsexp;a=summary -- attila -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-don-t-abbreviate-in-integer-key-max-len.-also-propa.patch Type: text/x-diff Size: 2459 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-some-care-for-replace.lisp-notably-get-rid-of-the-s.patch Type: text/x-diff Size: 5251 bytes Desc: not available URL: From john at fremlin.org Wed Sep 30 16:30:20 2009 From: john at fremlin.org (John Fremlin) Date: Wed, 30 Sep 2009 16:30:20 +0000 Subject: [cl-irregsexp-devel] some smaller patches In-Reply-To: (Attila Lendvai's message of "Wed, 30 Sep 2009 17:07:03 +0200") References: Message-ID: <87ocosieeb.fsf-genuine-vii@john.fremlin.org> Hi Attila, Thanks for the patches. I've looked them over. Attila Lendvai writes: [...] > Subject: [PATCH] don't abbreviate in integer &key max-len. also propagate them to make them usable as (foo (integer :max-length 2)) Propagation looks good. However, why do you feel the need to rename max-len and min-len? They are used already and there are still many variables called x-len . . . I guess I should add specialised float matchers too. [...] > Subject: [PATCH] some care for replace.lisp, notably get rid of the > single usage of iterate What's wrong with iterate? You change it to an nreverse! [...] > -(defmacro match-replace-helper ( string &rest match-replacements) > +(defmacro match-replace-helper (string &body match-replacements) Why are you using BODY here for a non-code form? > - (with-unique-names (before replacement-text after) > - `(let (,replacement-text) > - (if-match-bind (,before (or > - ,@(loop for (match replacement) in match-replacements > - collect `(progn ,match '(setf ,replacement-text (force-to-target-sequence ,replacement)))) > - (last)) > - ,after) > - ,string > - (values ,before ,replacement-text ,after) > - nil)))) > - > -(defun-speedy concat-byte-vector (seqs) > - (cond ((rest seqs) > - (let ((len (loop for s in seqs summing (length (the byte-vector s))))) > - (let ((ret (make-byte-vector len)) (i 0)) > - (loop for a in seqs do (let ((s (force-simple-byte-vector a))) (replace ret s :start1 i) (incf i (length s)))) > - ret))) > - (t > - (force-byte-vector (first seqs))))) > - > -(defun-speedy concat-string (seqs) > - (apply 'concatenate 'string seqs)) > +(defun-speedy concatenate-sequences (prototype sequences) > + (etypecase prototype > + (string > + (let ((*print-pretty* nil)) This makes no difference I believe ^^^^ > + (with-output-to-string (out) > + (dolist (el sequences) > + (write-string el out))))) This rewrite seems in aid of faster string concatenation. I have a good strcat somewhere, I can put that in. Do you have a benchmark? [...] From attila.lendvai at gmail.com Wed Sep 30 19:25:03 2009 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Wed, 30 Sep 2009 21:25:03 +0200 Subject: [cl-irregsexp-devel] some smaller patches In-Reply-To: <87ocosieeb.fsf-genuine-vii@john.fremlin.org> References: <87ocosieeb.fsf-genuine-vii@john.fremlin.org> Message-ID: > However, why do you feel the need to rename max-len and min-len? They > are used already and there are still many variables called x-len . . . abbreviations are bad, because there are a million of them while there's only on non-abbreviated form (ideally, if the naming is obvious). arguably in this case it should be :maximum-length but max/min is so well spread that it's one of the very few abbreviations that we accept internally in public API. but it's your lib... my patches are only suggestions! :) >> Subject: [PATCH] some care for replace.lisp, notably get rid of the >> single usage of iterate > > What's wrong with iterate? well, not much, except that it feels a bit like an oddball in the code with the iter: package prefixes. and it's one more dependency for a single use... otherwise i don't have much against iter (except that it screws up the environment which brakes various things inside its body, but that's a whole different story) > You change it to an nreverse! do some profiling... ;) it's not faster for sure, but i doubt you'll be able to point out the difference. > Why are you using BODY here for a non-code form? it plays much better with slime indentation, but that's about all. i usually freely exchange &body and &rest as they have no other effects than that (and documentation-wise it's arguable that the body there really is a body, that body is just a DSL not lisp...) > This makes no difference I believe ^^^^ profile it. on sbcl with-output-to-string creates a string-output-stream which is more expensive when pretty-printing stuff is initialized. > This rewrite seems in aid of faster string concatenation. I have a good > strcat somewhere, I can put that in. Do you have a benchmark? not for this specific case, but i went through quite a few profiling sessions and it seemed to be the fastest string concatenation (on sbcl). -- attila