12-07-2016 03:45 PM - edited 12-07-2016 03:46 PM
Hi All - If this is a duplicate question, please send me in the correct direction. I couldn't find a match.
I am using the OOP factory pattern to manage a configuration dialog. Each configuration section uses a child of the generic Configuration class. The child classes only contain a basic UI VI that consist of a front panel and event structure to detect a save or cancel. I have five child classes that are loaded.
It takes about 10 seconds to load the five simple classes. Is there something I am missing? I would expect this to take a fraction of a second.
See the attached image for the load process. The initialize VI simply assigns a name and gets a relative filepath and loads it into the object data. Object data defaults empty. No arrays or large strings are used.
Thanks for any suggestions!
12-07-2016 04:04 PM
One additional note: I could simply use the recursive file search to populate the Listbox and only dynamically load the specific class I need when it's clicked, but it seems to me that loading so few, such simple classes should not take so long.
I have tested this on multiple PCs with solid tech specs so it should not be a PC issue.
Windows 10 (64-bit)
LabVIEW 2016 (32-bit)
Core i7, 8 GB RAM
12-15-2016 11:19 AM
Any ideas from anyone? Maybe NI can help?
Thanks,
12-15-2016 12:00 PM
Is dynamic instanciation required or can you get away with statc references of the classes?
Ben
12-15-2016 12:16 PM
Dynamic dispatch is used so I can provide the user with new or updated configuration plugins on request without necessarily updating the rest of the code. But maybe you see a way to do that with static references that should load faster?
I'm trying to avoid coding a workaround of loading all the references ahead of time in the background, mainly because I feel like it simply just shouldn't take this long to load 5 simple classes. But maybe I'm being stubborn.
12-15-2016 12:24 PM
Instanciation is what you illustrated. NI's example of the Factory Pattern (when I last looked) was a case structure that had a different Class constant in each case so that it would spit out the desired class depending on the case selector.
Since the costants were in the case structure, they were loaded when the VI ws loaded.
Dynamic instanciation requires searching the disk and .. well you know the rest of the story.
Ben
12-15-2016 12:40 PM - edited 12-15-2016 12:40 PM
It's just surprising to me that it takes so long to load them. But I could preload them if it comes to that. I'd rather not have them hard-coded in a case structure.
Thanks for the discussion!
12-15-2016 03:51 PM
yes loading clases is slow. i am using labview 13 but NI claims that labview 16 is much faster but i have not mess with labview 16 to probe that