From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initializing IMAQ references in built EXE is way slower than in dev environment. Why?

Hi. I have a simple VI that initializes a large list (80000 elements) of IMAQ Image references. This happens in 6 seconds in the dev environment but if I put the VI in a blank project and make it an executable it takes 116 seconds for the same operation. Do you have any idea why this might be happening? The VI is attached. Thanks in advance.

0 Kudos
Message 1 of 6
(710 Views)

Are you counting the time it takes to load the runtime?  In dev mode, it's already loaded.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 6
(698 Views)

The time the .exe takes to load is like 1 second. That doesn't seem to be the problem. I have a bigger project with lots of VIs that its .exe loads instantly (~1 sec) but when I add the initialization of the images (same for loop attached before) it takes an eternity. No matter if it start the initialization of the images at startup or when I command (say 5 mins after the program is loaded) it's always the same outcome: fast in Dev mode, slow in .exe. 

0 Kudos
Message 3 of 6
(687 Views)

I don't know why executing "IMAQ Create" in an EXE would be slower than in dev environment.

 

  • Have you tried executing say 40,000 or 20,000 times? Does the EXE execution time reduce proportionally?
  • Which version of LabVIEW are you using? Do you have access to any other year-versions or bitness-versions? If yes, it might be worth building the EXE in the other version(s) and see if anything changes.
0 Kudos
Message 4 of 6
(654 Views)

I don't know either. Yes, I've tried initializing less images and it's the same the labview file ends the task in 5-10% of the time that the .exe requires to finish. For example, 10000 img references take 0.203 s in dev mode and 1.966 in the .exe form (the time they take to run also scales with the amount of images)

I have LabVIEW 2021 64 bits. I haven't tried any other version. I was hoping this was something fixable. But I will take your advice of trying different LabVIEW versions. Although it would be messy and time consuming. Do you have a different version of LabVIEW? Could you please try it?

 

It's just running the attached file the way it is; and opening a blank project, dragging the file to the project (save the project somewhere).Open it up, go to Build Specifications / New / Application (.exe), go to the Source Files tab and selecting the only VI as Startup VI. Then click Build. This takes 2 mins or less. Sorry the previous explanation was meant for everyone in the discussion, in case someone doesn't know how to create a .exe.

 

Thanks,

Andy.

 

0 Kudos
Message 5 of 6
(641 Views)

I have LabVIEW 2021 32-bit, but it doesn't have the Vision Development Module installed (the IMAQ functions are missing). I also have LabVIEW 2016 32-bit which does have the IMAQ functions. I opened the VI in LabVIEW 2021 and "Saved for previous" for LabVIEW 2016 (exact version: LabVIEW 2016 16.0 32-bit).

 

Below are the results I got when running the VI in LabVIEW 2016 dev environment and built as a LabVIEW 2016 32-bit EXE.

 

Number of images | Execution Time in Dev Env (seconds) | Execution Time in EXE (seconds)

1,000 | 2.135 | 0.171

2,000 | 4.174 | 0.652

3,000 | 6.373 | 1.423
4,000 | 8.634 | 2.465
10,000 | 23.871 | 15.248

 

Observations

  • I didn't run it for 80,000 images, as it was taking too long.
  • It executed much quicker in EXE than in Dev Env. This is opposite to what you are seeing.
  • The execution time increases faster than linearly, especially in EXE. I can't explain why, but it's not entirely unexpected, as it probably depends on LabVIEW and OS memory management.
  • My LabVIEW version is a few years older than yours (2016 vs. 2021) and is 32-bit whereas yours is 64-bit.
    • One or both of these differences might make the VI execute more quickly on your system than on mine.

Questions

  • Why do you need to create 80,000 IMAQ images?
  • Do you need to create all the images in one go? Can you split up the creation into multiple chunks that execute at different times in your application?

Computer Specs

My computer is a Dell XPS 8930 desktop. It's generally pretty fast (specs below).
Computer Specs.png

 

 

 

 

 

0 Kudos
Message 6 of 6
(600 Views)