I have created project in which there is a Main.vi that loads a class dynamically. I created an executable and a PPL for the same project. while building an executable I included the child class in build but in the case of PPL I have the child class as a plugin that can be loaded dynamically. I did some timing tests and what I noticed was that the executable took less time to load a class (from memory) than a PPL. I don't understand why. In both the cases, the codes are compiled and all the VIs corresponding to the class will be loaded into memory. But still the PPL took more time. I need to have a clear understanding of why this happens. Anyone has an idea on why this happens?
Which version of LV are you using?
There have been some improvements for loading PPLs over the versions, so maybe you can benefit from updating LV...
I am not sure if there have been significant improvements from 2014 on (2015 or 2016) regarding loading times of the PPLs.
However, i have to point out that PPL load times will always be "slower" compared to compiling everything into a single EXE:
- OS has to locate a different file on disk
- When loading a monolithic EXE, the load time occurs right away. Loading a PPL occurs when the EXE is already running. That means that the load times distribute differently which induces a different user experience
- Even though you might use only one VI from the PPL, still the whole PPL will be loaded into memory. You cannot 'select' one VI from the PPL and disregard the others. However, only the called VI will create a dynamic data space. Each newly called VI from the PPL (EXE is the same here) will have to allocate dynamic memory essentially slowing things down (for the first call appropriatly)
- There might be loading conflicts which are not shown to the users. Remember that child classes require the parent class. Hence, your parent class(es) is(are) located both in the EXE and the PPL. That being said, loading conflicts (and required verification) are common (potentially without showing up)
I am not saying, that LV provides the best performance possible (though i hope it does!), but due to above mentioned facts, there will always be differences in loading performance. The trick you can do is to distribute loading times conciously by calling dummies at a time where loading times don't hurt. This at least reduces impact on the user experience.
Thanks for your time and reply but I think you have got my question wrong. You have got it like, I have an exe, from which I load a class from PPL.(Forgive me if I am wrong).
Actually, I am trying to compare the class load times in an exe and a PPL. So the exe and PPL have the same source code and does the same operations but the way they are built differs. The execution of the exe and PPL are independent. I notice a delay in PPL class loading and I am interested why is it so.
Can you attach a (very) small example of your benchmark code? I'm specifically interested in the way you are calling the stuff and where/when you are taking the timestamps for the benchmark....
My code is huge and has a lot of sub VIs. So I ll try to explain clearly. The main VI has a tree and a subpanel. the tree has some device listed. There are classes for each device with its own private data and methods to load device specific information. when I select a device in the tree, the UI gets loaded along with its data(The UI has indicators that could display the data. The private data gets displayed in those indicators using accessors). What I want to do is to calculate how much time it takes for a device to load its private data when the user selects a device. So I have placed time stamps at the place where I capture the tree selection change event and at the place where all the device details get loaded and the code become idle.
Hope this would make things clear:)
Ok, here is what i understand:
You benchmark starting with a LV internal UI event when you load external code ('package').
Option a) loads an EXE using System Exec.vi.
Option b) loads a PPL.
EXE and PPL essentially include the same code base.
What i struggle with:
- What means "the code becomes idle"?
- What interfaces are you using to communicate with the code inside the 'package'? Are they the same in both cases?
What are the values you see for both options?
My code is to communicate with a connected device(i.e)to make some settings and take measurement. As I already mentioned, I wish to find the time taken to switch between devices. So I benchmark at the point where I capture the "tree value change" event(in an event structure).
- After loading all the device specific information my code waits for some user action(A configuration change or Measure boolean click). I mentioned this waiting as idle.
- I don't understand the term interface. I have used class overriding methods to communicate with each device class. And yes. They the same in both cases.
Hope that's clear.