Any performance optimization guideline for frequent API call case?

Is there any recommendation or guideline for frequent API call cases?
ex) Continuous 10ms (100 times in a sec) API calls

If there are many executeAsModal() calls, Photoshop API cases exception. “Too many modal scope commands” and “Large number of pending promises”. I think it seems issue on more than 20+ built up cases.

Then I tried timered buffering to throttle down API request like 100ms or some case 200ms. It works, ut user response degrade. 100ms is not much noticeable, but still not smooth in some cases.

I asked to Dev Day event and got info about isModal() and modalJavaScriptScopeExit
Thank you for Jaroslav and Jesper at the time.

As I tested the flag and event seems working fine.But I’m not quite sure how to optimize the API calls. So is there some recommendation or guideline?

It might be wrong, but my understanding is that Photoshop API has its own queueing mechanism. Request comes back but some times it is executed a bit later. I’m not sure if it is synced with modalJavaScriptScopeEnter and modalJavaScriptScopeExit event timing, or it can be different timing.

Any tips, help are appreciated. Thank you.

Maybe @samgannaway can help?

1 Like

Oh, that guy? You’d have to find him first.

1 Like

Internal to Adobe, this is tracked as PS-109930. (Mostly for my own future reference…)

1 Like

For one enterprise client… I created code sample where PS stays in modal state as long as it receives additional actions to execute. There was endless loop with something similar to “sleep” and condition to leave endless loop if no action was accepted for longer period of time. It was very smooth and fast.

1 Like