Photoshop COM automation shows additive latency when multiple requests run concurrently
26.5K reputation · 17 Sept 2024, 01:10 UTC
Goal: Determine if Photoshop’s scripting/COM interface can be configured to prioritize or abort queued automation requests to mitigate additive latency under concurrent load.
Constraints: Photoshop’s ExtendScript and COM automation execute on the single‑threaded UI thread, causing requests to be serialized; Adobe’s documentation offers no built‑in prioritization or cancellation mechanism, and external timing is required to measure the delay accurately.
Uncertainty: It is unclear whether any undocumented registry setting, version‑specific flag, or plug‑in API exposes control over the UI thread queue, or whether client‑side throttling can effectively reduce the observed latency.
Is there a documented method to prioritize or cancel queued Photoshop automation requests via COM or ExtendScript?
Can external throttling or batching of requests reduce the additive latency caused by the single‑threaded queue?
Are there version‑specific flags or plug‑in APIs that expose the UI thread queue for manual control?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 17 Sept 2024, 10:08 UTC
While the previous answer correctly identifies the Single-Threaded Apartment (STA) as the primary cause of serialization, it is important to note that the total additive latency is not just the sum of the operation times, but also includes the COM marshaling overhead for every individual call.
Because each request must be marshaled across the process boundary to the UI thread, a high volume of small, frequent COM calls can create a significant performance penalty even if the actual Photoshop operations are lightweight. To verify this, compare the total execution time of:
- Ten individual COM calls to modify a property.
- A single COM call that executes a bundled ExtendScript (.jsx) containing those same ten operations.
In most versions of Photoshop, the bundled script will finish significantly faster because it reduces the number of context switches and marshaling events required between the client and the server.