From tomasz.skutnik at gmail.com Mon Jun 9 22:00:16 2008 From: tomasz.skutnik at gmail.com (Tomasz Skutnik) Date: Tue, 10 Jun 2008 00:00:16 +0200 Subject: [cl-emb-devel] cl-emb speedup Message-ID: <533c96720806091500t3261cebfr79b790dc2e8cd556@mail.gmail.com> Hi. I've started some serious development using cl-emb, and found that it's template parsing/compilation was unbearably slow. Even simple few character template parsing and compilation results in massive CPU and memory burn. So I've profiled it a bit using SBCL statistical profiler and found that it was all due to very suboptimal use of ppcre:regex-replace-all. Long story short (well, not so long) regex-replace-all was alway passed strings, which resulted in very costly ppcre scanner building every time any template was parsed. Simple memoization in expand-template-tags did the trick - scanner object is built only on first use. Below you will find patch that modifies cl-emb accordingly. Code heavily borrows from Edi Weitz's Hunchentoot's scanner-for-get-param and Tim Bradshaw's memoize library. Thanks guys. Additionally patch exports new external function clear-expand-template-tag-hash, that clears internal cache. It's provided because template tags expansion depends on *emb-start-marker* and *emb-end-marker* that potentially can be modified during runtime, to there exist possibility that someone might need to clear scanner cache after modifying start and end marker values. Hope that you'll find that patch useful. Tomasz P.S. When next cl-emb version will be released? Will my previous patch be incorporated? -------------- next part -------------- A non-text attachment was scrubbed... Name: cl-emb-0.4.3.patch Type: text/x-diff Size: 2859 bytes Desc: not available URL: From sscholl at common-lisp.net Tue Jun 10 19:52:48 2008 From: sscholl at common-lisp.net (Stefan Scholl) Date: Tue, 10 Jun 2008 21:52:48 +0200 Subject: [cl-emb-devel] New release CL-EMB 0.4.4 Message-ID: <20080610195248.GN4313@parsec.no-spoon.de> New release CL-EMB 0.4.4 CL-EMB is a library to embed Common Lisp and special template tags into normal text files. Can be used for dynamically generated HTML pages. You can download it from http://common-lisp.net/project/cl-emb/ or install with ASDF-Install. CL-USER> (asdf:operate 'asdf:load-op :asdf-install) CL-USER> (asdf-install:install :cl-emb) Changes: - Multibyte external file format patch (Tomasz Skutnik) - Speedup by memoization in expand-template-tags (Tomasz Skutnik) From sscholl at common-lisp.net Tue Jun 10 19:58:52 2008 From: sscholl at common-lisp.net (Stefan Scholl) Date: Tue, 10 Jun 2008 21:58:52 +0200 Subject: [cl-emb-devel] cl-emb speedup In-Reply-To: <533c96720806091500t3261cebfr79b790dc2e8cd556@mail.gmail.com> References: <533c96720806091500t3261cebfr79b790dc2e8cd556@mail.gmail.com> Message-ID: <20080610195852.GO4313@parsec.no-spoon.de> Hi Tomasz! On 2008-06-10 00:00:16, Tomasz Skutnik wrote: > Below you will find patch that modifies cl-emb accordingly. Code Awesome! Thanks for that! > P.S. When next cl-emb version will be released? Will my previous patch > be incorporated? Just now. Sorry, my "patch pipeline" was a bit clogged. I hope I haven't forgotten anyone. Regards, Stefan PS: A new CL-WIKI will be released tomorrow, in case someone is waiting. -- Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/