Jump to content

Div — simple windows manager

Recommended Posts

12 hours ago, pawelgrzybek said:




I noticed that since I added a support for multiple screens it takes a little bit longer for this workflow to do its job. It was expected tho. This workflow is built wit AppleScript and requires few calculations whenever you trigger the workflow. It needs to be aware of the screen size, how many screens, position of screens etc. On top of that it injects a NSScreen class from ObjectiveC macOS library — it takes some time to invoke it too.


I am not macOS dev / AppleScript expert, but I will do my best to improve the performance of this workflow. if you have any hints how to measure a performance of particular function / method it would be very helpful.


Native tools like BetterTouchTool etc. are built using compiles languages like ObjectiveC / Swift. It makes this apps very fast. Pros and cons. Div is just few kbs AppleScript workflow but performance isn't the best, BetterTouchTool is few mbs separated app but its very fast.




Thank you for explaining. Sorry but I have no hints, I am not experienced with AppleScript etc. but there are many knowledgeable people on the forum so if anyone has tips it is appreciated. Even though this tool is not super fast it is still fast enough in my opinion to be quite useful, thank you again for making it. 

Edited by cands

Share this post

Link to post
13 hours ago, pawelgrzybek said:

if you have any hints how to measure a performance of particular function / method it would be very helpful.


Run the function 100x in a loop and time it?


In my experience, it's sending Apple Events to other applications that's really, really slow. From the testing I've done on my machine, it takes about 0.2s to call out to another application. The calculations the workflow performs will take a very trivial amount of time relative to that.


As such, you should focus on minimising tell application ... calls. As best as I can tell from looking at the code, there are at least three tell application ... calls per run, which accounts for the majority (>0.5s) of the workflow's runtime, imo.


Can you not combine the two scripts (div.scpt and divObjC.scptd) and save the tell application "Finder" ... call? It might also be possible to do only one tell application "System Events" to set activeApp ... call.

If you could do that, it would halve the workflow's run time.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...