About speed of AppleScript when creating collections
Hello.
I have an AppleScript script which reads a file and creates a group of user collection items. It works but it's slow: it takes 50 minutes for completing (it creates roughly 2000 groups and 2000 smart albums). If I comment out the lines creating the collections (so it just reads and processes the file) it completes in 5 minutes, so 90% of time is spent in interacting with Capture One.
While this is a serious annoyance but not a showstopper (I need to run it only once in a while), I wonder whether there are hints/tricks for optimising performance.
Thanks.
-
Furthermore, it seems that it gets slower and slower every time I run it. Today it took 120 minutes for completing (same catalog, just a few changes in the input file). It basically took 1 second for each album to create...
0 -
Hi Fabrizio
I reviewed your script and I do not see anyway of improving the speed.
All the trick I know of optimizing speed involve asking Capture One to read back as much data as possible at each request (so you cut down on the number of CO comands)
One thing I wonder is that I do not see how you are handling collisions, e.g. trying to create a folder which is already present. (or avoiding that).
It seems to me that once you have run the script once, then in future runs most of the folder structure must already exist.
0 -
Thanks for finding the time to review my script.
Collisions are avoided by creating each time a "Catalog" root with a different timestamp (e.g. "Catalog 2021-08-03 19:57:19"); in this way, should the script not terminate correctly, I can delete the new partial stuff and keep the previous version. Otherwise I keep the new version and delete the old one.
0 -
It seems related to a sort of degradation of the database or such. Today I added some logging and I could see that this morning it took about a second to create a group/smart album. In a later run sometimes is still took one second, other times it slowed down and took about three. Then it went back to one, and eventually again three.
Of course I didn't run other apps at the same time, the CPU were hardly allocated.
I tried to manually create a group with the UI of Capture One while the script was running, and it took the same time the script was taking: about a second, or two/three seconds when the extra slowdown occurred.
On the other hand the functions to update the progress notification are always very fast. So it's not an overhead of the AppleScript adapter.
Note that I've tested it after quitting Capture One and forcing an optimisation of the database.
0
Post ist für Kommentare geschlossen.
Kommentare
5 Kommentare