Re: Reformatting a string
Re: Reformatting a string
- Subject: Re: Reformatting a string
- From: Jon Pugh <email@hidden>
- Date: Sun, 29 Jan 2012 19:44:50 -0800
On Jan 29, 2012, at 4:59 PM, Shane Stanley wrote:
> I then tried some tests with the SmartString vanilla method. With a short string, say a few characters, it was super fast. But as the length of the string went up, the time taken increased exponentially -- for a 128-byte string it took about 6 seconds, for 256, about 26 seconds, and for 512, 126 seconds. So it started off more than competitive, but got left behind very quickly. A 256-512 characters is not a large string in the real world.
Yeah, there’s a double loop in there that’s likely the culprit. I just recently fixed an issue with a missing “exit repeat” to short circuit the loop when it finds a match, however I’m sure there’s a bunch of special case optimizations that could occur. Especially on strings that don’t need case operations. The current algorithm isn’t designed for speed, it’s designed for flexibility.
C has a lot more capability for speed when doing string manipulation. AppleScript tends to bog down when doing anything involving iterating over strings.
Nevertheless, I’ll look into making it faster as time permits.
Thanks.
Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden