Copy link to clipboard
Copied
Or have reference to benchmarks?
Some of my plugins are unbearably slow. One of the things that concerns me is the speed of string operations.
I'd also be interested in performance of non-string ops, so I can write more efficient plugins.
R
Copy link to clipboard
Copied
Based on my (very) light reading about the Lua implementation, I'd guess that Lua string operations are roughly the same cost as Java string operations. There are two components to the cost: doing the byte manipulations, and the amortized cost of garbage-collecting the strings later. Unlike Java, Lua needs to hash each string into a global string table, but the incremental cost of that is likely smaller than you think for many apps, since tests for equality take a single instruction, and the hashing can reduce additional storage allocations. Also, I'd guess that the Lua garbage collector is not as efficient as a modern Java GC, but that's just an educated guess.
Copy link to clipboard
Copied
You might consider profiling your plugins using the function Debug.profileFunc() from my debugging toolkit (free, of course):
http://www.johnrellis.com/lightroom/debugging-toolkit.htm
This is an elapsed-time profiler, which is generally more useful than a CPU-time profiler. Because it imposes a non-trivial overhead on each profiled function, start profiling higher-level functions and then drill down into the bigger hogs.
One thing I've found is that a number of the SDK API functions appear to call LrTasks.yield() (or equivalent), and this seems to impose a minimum overhead of at least 10 - 20 ms. Doesn't seem like much until you discover you're calling it hundreds or thousands of times.
Copy link to clipboard
Copied
Thanks John,
I will give the debugging toolkit a closer look - theres a lot there 🙂
Rob
Copy link to clipboard
Copied
I noticed the yield issue as well. But it's only problematic on Windows
I'm creating a dialog with 128 pulldown menus, on Mac it takes less than one second to appear. On Windows, it takes 10+ seconds. Almost worth putting separate progress dialog for configuration dialog...
Jarno
Copy link to clipboard
Copied
I noticed the yield issue as well. But it's only problematic on Windows
Yeah, I measured the cost of LrTasks.yield() on Mac to be about 1/100 to 1/1000 of that on Windows. And I noticed that a number of API functions, e.g. the keyword-accessing functions, went proportionally faster on Mac as well.
Copy link to clipboard
Copied
I think Lightroom was initially developed on Macs, for Macs, by Mac developers..., then "ported" to Windows. I mean they probably had Windows in mind from the start, and I dont know the mechanisms whereby they accomplish a dual-platform product, but there is clearly a Mac bias in the programming, so no surprise if there are some things better optimized for a Mac...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now