LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV OOP Factory Pattern Slow to Load Classes

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!

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 1 of 8
(4,185 Views)

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

 

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 2 of 8
(4,173 Views)

Any ideas from anyone? Maybe NI can help?

 

Thanks,

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 3 of 8
(4,073 Views)

Is dynamic instanciation required or can you get away with statc references of the classes?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(4,067 Views)

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.

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 5 of 8
(4,063 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 8
(4,058 Views)

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!

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 7 of 8
(4,053 Views)

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

CLAD, CTD
0 Kudos
Message 8 of 8
(4,040 Views)