apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacques Amar <jal...@amar.com>
Subject Re: PCRE modules in APR?
Date Tue, 30 Dec 2008 18:39:00 GMT
Nick Kew wrote:
> On 29 Dec 2008, at 19:43, Jacques Amar wrote:
>> Hello,
>> Sorry if this is already answered elsewhere, couldn't locate it.
>> Is there already a Perl Compatible Regular Expression (PCRE) wrapper 
>> for APR? My understanding is that we simply need to take over the 
>> calls to malloc and free with the provided function pointers. malloc 
>> seems easy enough to map to a pool. I'm having a conceptual problem 
>> with the free portion.
> No.  There is a PCRE wrapper in httpd, but that just exposes the old
> regexp API.
>> I also rolled my own search and replace routines - but the 
>> performance sucks on large input. Any suggestions on how to 
>> manipulate strings with the cutting and stitching required? I've used 
>> an APR_ARRAY push during processing and cat it all together once 
>> done. perl code doing the same s/// takes way less time.
> Have you looked at the APR-ified sed code in mod_sed (httpd again)?
>> Let me know if I need to provide code examples.
> Are you suggesting an APR-ified PCRE is going to yield substantial
> performance benefits, and are you offering to do the work?  If so,
> it could be a worthwhile addition.

As I mentioned in another reply, I traced the performance issue to UTF-8.

The only reason I'm using PCRE is that the search expressions are rather 
complex and regex is one way to describe them - and I know regex pretty 
well. The solution I've rolled can be augmented into an APU module with 
general PCRE Search and Replace, if I clean it up. It's using many 
separate pools right now, that I create in advance for (assumed) 
performance reasons.

I'll have to see if I can simplify it and make it more general purpose, 
so it's not tied to my module - maybe using the optional functions or 
the provider API. (need to re-read chapter 10!) I probably will need 
help with the Makefiles, so I'll be back

Sidenote: Love your book! Could use more examples in the chapter 3 about 
APR with more complex examples. For instance, I struggled quite a bit 
with advanced hashes/tables and had to hunt down example code to 
understand it better. Mind you, you learn more by trying.



View raw message