• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reformatting a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reformatting a string


  • Subject: Re: Reformatting a string
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 30 Jan 2012 11:59:04 +1100

Before this thread dies...

I just did some *very rough* timings for various methods: using Satimage and its lowercase command; using Satimage and regex, as posted; using Yvan's method to call Python; and my ASObjC Runner script, with a minor change. The test was simple: repeat 1000 times, using current date as timer. The results are likely to vary with different Macs because of things like CPU cores (for example, Activity Monitor was showing my version using about 80% CPU for ASE and 180% CPU for ASObjC Runner on my fairly new iMac, which isn't going to happen on, say, a portable).

So the fastest version was the one using Satimage and its lowercase command. Using Satimage with regex took about a third to a half longer. Using ASObjC Runner was somewhere in between, probably closer to the regex version. The shell/Python method was a long way behind, which is to be expected with all that overhead. It was around 7 times slower. (All run from apps)

The tests were made with a string of about 50Kb. They all got quicker with shorter strings, but not linearly or equally.

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.

I tried one more test, using a larger string and more repeats, comparing the Satimage lowercase version with an AppleScriptObjC version saved from ASE as a Cocoa-AppleScript app (ie, no ASObjC Runner involved, so arguably vanilla of sorts). It was a wash. (although AppleScriptObjC apps take considerably longer to launch.)

As they say these days, whatever...

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>



 _______________________________________________
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


  • Follow-Ups:
    • Re: Reformatting a string
      • From: Jon Pugh <email@hidden>
References: 
 >Reformatting a string (From: Angelo <email@hidden>)
 >Re: Reformatting a string (From: Luther Fuller <email@hidden>)
 >Re: Reformatting a string (From: Jon Pugh <email@hidden>)
 >Re: Reformatting a string (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: highlight text and us in URL to display web panel - slightly ot
  • Next by Date: Re: Reformatting a string
  • Previous by thread: Re: Reformatting a string
  • Next by thread: Re: Reformatting a string
  • Index(es):
    • Date
    • Thread