Jump to content

Div — simple windows manager


Recommended Posts

12 hours ago, pawelgrzybek said:

 

Hi.

 

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.

 

Thanks

 

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
Link to comment
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.

Link to comment
  • 9 months later...
On 2/11/2019 at 9:08 PM, deanishe said:

 

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.

 

Thanks a lot for all your advices!

Link to comment
On 11/25/2019 at 10:26 PM, dp1207 said:

 

This appears to have stopped working in Catalina. Not sure why. Does anyone know how to fix it or a replacement?

 

Hi. On new macOS it works as expected. The only thing that possibly needs to be done, you need t give Alfred an access to accessibility control inside the "Privacy" tab on "Security & Privacy" Preferences section. Other than that it should work just fine.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...