<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/jive/rss" version="2.0">
  <channel>
    <title>Adobe Community: Message List - Creating large collections via the SDK</title>
    <link>https://forums.adobe.com/community/lightroom/lightroom_sdk?view=discussions</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    <pubDate>Sun, 13 Oct 2013 22:39:10 GMT</pubDate>
    <generator>Jive Engage 7.0.0.1  (http://jivesoftware.com/products/)</generator>
    <dc:date>2013-10-13T22:39:10Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Re: Creating large collections via the SDK</title>
      <link>https://forums.adobe.com/message/5757137?tstart=0#5757137</link>
      <description>&lt;!-- [DocumentBodyStart:a40975c9-6080-40d9-afe3-4954f65b174c] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;&lt;blockquote class="jive-quote"&gt;&lt;span style="font-family: adobe-clean, 'Helvetica Neue', Arial, sans-serif; background-color: #e7e7e7;"&gt;when you add photos to a collection via SDK, you are also giving work to Lr native to do in the background (i.o.w. it's not finished when you return from with-do), and so as you go SDK is competing more with Lr native (Lr native may be becoming increasingly back-logged). Dunno if that has any bearing, but perhaps worth consideration...&lt;/span&gt;&lt;/blockquote&gt;&lt;/p&gt;&lt;p&gt;It did indeed have a bearing.&amp;nbsp; I noticed that background work too, so my measurement script had a 1-minute delay between the creation of collections, and I verified that was sufficient for LR to finish up its background work (in terms of CPU and disk i/o).&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:a40975c9-6080-40d9-afe3-4954f65b174c] --&gt;&lt;img src='/beacon?t=1415888243387' /&gt;</description>
      <pubDate>Sun, 13 Oct 2013 22:39:10 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/5757137?tstart=0#5757137</guid>
      <dc:date>2013-10-13T22:39:10Z</dc:date>
      <clearspace:dateToText>1 year 1 month ago</clearspace:dateToText>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: Creating large collections via the SDK</title>
      <link>https://forums.adobe.com/message/5757093?tstart=0#5757093</link>
      <description>&lt;!-- [DocumentBodyStart:e9dbfce3-2fd0-4f52-b4ec-0315731b8d2e] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;One thing to consider: when you add photos to a collection via SDK, you are also giving work to Lr native to do in the background (i.o.w. it's not finished when you return from with-do), and so as you go SDK is competing more with Lr native (Lr native may be becoming increasingly back-logged). Dunno if that has any bearing, but perhaps worth consideration...&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Lr performance is a big giant mystery to me. I mean, just exporting, I can watch Lr performance slow and slow and slow (when exporting large numbers of photos), even when there appears to be no memory leak. Ditto for other ops. So although I can't explain your observation (i.e. the decreased performance adding lotsa photos to collection), (nor any of my similar observations), it doesn't surprise me either.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Rob&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:e9dbfce3-2fd0-4f52-b4ec-0315731b8d2e] --&gt;</description>
      <pubDate>Sun, 13 Oct 2013 22:10:25 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/5757093?tstart=0#5757093</guid>
      <dc:date>2013-10-13T22:10:25Z</dc:date>
      <clearspace:dateToText>1 year 1 month ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Creating large collections via the SDK</title>
      <link>https://forums.adobe.com/message/5757027?tstart=0#5757027</link>
      <description>&lt;!-- [DocumentBodyStart:e832fab6-3d1f-4818-9bfe-e5dc01e1cb44] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;I'm having significant performance problems creating large collections via the SDK -- it's much slower than creating collections in the user interface.&amp;nbsp; For example, using the SDK to create a collection of 15K photos is 8 times slower than via the user interface (218 versus 27 seconds)!&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Does anyone have any relevant experience at making large collections?&amp;nbsp; Am I missing something?&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Here's what I've learned so far. Using a fresh test catalog of 25K photos,&amp;nbsp; I first measured the simplest approach to creating a collection:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catalog:withWriteAccessDo (no timeout params)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catalog:createCollection
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; collection:addPhotos 
&lt;/pre&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is fine for collections with fewer than 1K photos, but at 2K photos and larger, it really starts slowing down dramatically:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;&lt;a href="https://forums.adobe.com/servlet/JiveServlet/showImage/2-5757027-486616/Table1.PNG"&gt;&lt;img alt="Table1.PNG" class="jive-image" height="359" src="https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5757027-486616/Table1.PNG" width="207"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;&lt;a href="https://forums.adobe.com/servlet/JiveServlet/showImage/2-5757027-486620/Graph1.PNG"&gt;&lt;img alt="Graph1.PNG" class="jive-image" height="336" src="https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5757027-486620/Graph1.PNG" width="368"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It takes almost two minutes to make a collection of 8K photos and ten minutes for a collection of 25K photos!&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Next, I tried adding photos in chunks of, say, 128 photos, one chunk per transaction:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; catalog:withWriteAccessDo (no timeout params)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catalog:createCollection

&amp;nbsp;&amp;nbsp;&amp;nbsp; for each chunk of 128 photos
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catalog:withWriteAccessDo (no timeout params)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; collection:addPhotos (128 photos)
&lt;/pre&gt;&lt;p&gt;I measured various chunk sizes from 1 to 2048, and there's not much difference in total time with sizes between 64 and 1024.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;But even with chunking, the SDK is much slower than the UI at creating collections:&amp;nbsp; &lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;&lt;a href="https://forums.adobe.com/servlet/JiveServlet/showImage/2-5757027-486621/Table2.PNG"&gt;&lt;img alt="Table2.PNG" class="jive-image" height="219" src="https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5757027-486621/Table2.PNG" width="332"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In general, the larger the collection, the slower it is to create in the SDK - creating a collection of 10K photos is 5 times slower, and creating a collection of 15K photos is 8 times slower!&amp;nbsp; Here's a plot showing the ratio of the SDK time to the UI time versus the size of the collection:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="https://forums.adobe.com/servlet/JiveServlet/showImage/2-5757027-486622/Graph2.PNG"&gt;&lt;img alt="Graph2.PNG" class="jive-image" height="271" src="https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5757027-486622/Graph2.PNG" width="413"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It's very suspicious that the slowth is linear in the size of the collection.&amp;nbsp; This suggests the SDK is using an inappropriate n-squared algorithm compared to the UI.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I wonder if the difference between the UI and SDK methods is how the SDK handles the undo stack?&amp;nbsp; I'd guess the underlying SQL operations on the catalog are identical and not the cause of the difference, but who knows.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;These measurements were all done on LR 5.2 Windows 7 64-bit 8 GB memory and 7200 RPM disk.&amp;nbsp;&amp;nbsp;&amp;nbsp; LR 4.4 behaves very similarly.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;PS: I've been exploring the use of collections to represent search results in Any Filter.&amp;nbsp; Given LR's bias towards collections instead of filters, many users feel more comfortable accessing the search results via collections. And collections would make it easy for a user to "go back" to a previous set of search results.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:e832fab6-3d1f-4818-9bfe-e5dc01e1cb44] --&gt;</description>
      <pubDate>Sun, 13 Oct 2013 21:55:39 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/5757027?tstart=0#5757027</guid>
      <dc:date>2013-10-13T21:55:39Z</dc:date>
      <clearspace:dateToText>1 year 1 month ago</clearspace:dateToText>
      <clearspace:replyCount>2</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
  </channel>
</rss>

