Re: Regex -- TextCommands vs. Satimage
Re: Regex -- TextCommands vs. Satimage
- Subject: Re: Regex -- TextCommands vs. Satimage
- From: has <email@hidden>
- Date: Mon, 21 Nov 2005 21:17:24 +0000
John R. wrote:
>I understand that has's TextCommands can do "lazy" regex searches, whereas Satimage can not. [...] I suspect that Satimage made a design decision NOT to support lazy searches in favor of speed.
I think it's probably just an accident of history. Satimage.osax uses a standard POSIX extended RE library, and POSIX REs aren't as rich as the Perl-compatible REs used by TextCommand's (really Python's) PCRE regex library. Non-greedy matching is one of the features not found in POSIX REs. As to why Satimage picked a POSIX RE library in the first place, you'd need to ask them that to know for sure, though I imagine it was simply a case of them using whatever seemed most handy (and licence-compatible) at the time, and POSIX RE libraries are pretty common.
As far as determining causes for the observed difference in speed, you have a whole host of factors to consider: cost of intraprocess vs interprocess Apple event dispatch, pure C vs. mixed Python/C implementation, string vs unicode text searching, and two underlying regex libraries with very different implementations and optimisation. Therefore, you really need to eliminate all other variables except the one you actually want to measure, e.g. if you want to compare greedy vs non-greedy search times, use TextCommands to do both; if you want to compare Satimage.osax against TextCommands.app for raw turnaround, use the same search pattern in both cases.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden