0 Replies Latest reply on Feb 20, 2011 9:40 PM by areohbee

    Beware: Storing tables of preferences is REALLY slow!

    areohbee Level 6

      I recoded a plugin to use small tables of preferences instead of storing each element individually keyed - takes 150 times longer to execute!


      I used John Ellis' Debug Profiler to isolate it to the storing of tables of preferences.


      Relatively Fast:


      prefs['item_1_elem_1'] = value_1

      prefs['item_1_elem_2'] = value_2

      prefs['item_1_elem_3'] = value_3


      prefs['item_2_elem_1'] = value_21

      prefs['item_2_elem_2'] = value_22

      prefs['item_2_elem_3'] = value_23





      Really Slooooooow:


      local t = {

         elem_1 = value_1

         elem_2 = value_2

         elem_3 = value_3


      prefs['item_1'] = t


      local t2 = {

         elem_1 = value_1

         elem_2 = value_2

         elem_3 = value_3


      prefs['item_2'] = t2



      At least its slow as molasses on my Windows system, didnt try Mac. (for those who dont know the LrTasks.yield function is over 100 times slower on Windows than Mac, maybe this is the culprit).


      PS - If you really need speed, best to store "preferences" in a regular file instead of in Lightroom preferences.