DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

View sheet embedded dialog takes 10x longer to execute channel data manipulation

DIAdem 2020 version 20.0.0f7762 (64-bit).

 

I noticed that an dialog embedded in a View sheet takes considerably longer to perform channel data manipulation and calculations than when it is executed without being embedded in a View sheet.  I created a script file and test dialog to study the issue and replicate the problem.  On my system, the View sheet embedded takes 10x longer to execute. 

 

I also learned that if I directly call the button in the dialog from a script, then the dialog executes quickly.  

 

I also observed that if any channel is 2D plotted in View, execution takes even longer. 

 

Download the test files from:  

 

http://www.savvydiademsolutions.com/images/client/DIAdemDlgEmbeddedViewExecutionTest.zip 

 

Or this DropBox link:

https://www.dropbox.com/s/1f15ex2671fae89/DIAdemDlgEmbeddedViewExecutionTest.zip?dl=0 

0 Kudos
Message 1 of 8
(3,145 Views)

Hi Mark,

 

I'm not familiar with the SUDialog VIEW area performance issue, but it is well known that changes to data channels that are currently being graphed in VIEW causes those changes to occur more slowly.  I've always assumed that the graph in the background is recalibrating its axes' min/max values each time the graphed channel changes.  Are you assigning channel values one at a time or all at once with a channel overwrite or DIAdem ANALYSIS command?

 

There's a property in the VIEW object to suppress area updates that you could set that way while making changes, but the simplest solution is to create a temporary channel and then copy all its values over top of the graphed channel all at once.  Or replace your one-value-at-a-time VBScript loop with one or more DIAdem commands that define an array of values in a channel.

 

You might also consider dedicating a DIAdem Worker to this channel updating task-- there's a shipping example that does this that speeds up the VIEW display tremendously.

 

Brad Turpin

Principal Technical Support Engineer

National Instruments

0 Kudos
Message 2 of 8
(3,094 Views)

Nothing is plotted in the View panel during the channel generation or analysis. 

 

Commands ChnLinGen() and Calculate() are used to generate the channels (executes very quick), but I also added a ChnStatisticsChannelCalc() in a loop to calculate statistics over intervals of values in the channel (to simulate an analysis situation).   I tried to create the most simple example of the problem using these three commands.  

 

The issue is, it takes 10x longer to run that same dialog in a View sheet (area of type dialog), versus just as a dialog called using SUDDlgShow().   I wanted to use the dialog in a View sheet to create a custom application that would allow the user to interact with the channels analyzed by the dialog, but not at the expense of a 10x longer channel analysis time.  

 

 

0 Kudos
Message 3 of 8
(3,088 Views)

Hey Mark,

 

I'd like to report this performance difference to R&D.  It may be something tangled up in the VIEW area container architecture that they can't affect easily, but I'd like them to at least take a look at it and comment why they think the performance is so much slower-- 10x is a ton.

 

Can you post or email your demo application for us to reproduce with?

 

Thanks,

Brad Turpin

Principal Technical Support Engineer

National Instruments

0 Kudos
Message 4 of 8
(3,074 Views)

Hi Mark,

 

Thanks for re-posting those 2 links.  I downloaded your code and reproduced everything on my DIAdem 2020 SP1 just like you stated it.  Interestingly, my older laptop ran about 4x slower than your commented execution times, but the 10x speed difference still held for me exactly.

 

I have created Bug #1200351 with a full description and your reproducing files.  Here's hoping R&D can figure this out.

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 6 of 8
(2,964 Views)

Hi Mark,

 

R&D answered that what you are observing is not a bug, per se.  If a SUDialog is running non-modally and is not executing an external script with ScriptStart(), then DIAdem has to check after every SUDialog command that the displayed controls are correct.  Apparently this involves a lot of internal messages, which slows down the code considerably.  R&D says this effect occurs regardless of whether the SUDialog is embedded in a VIEW Area-- the key issue is running it non-modally.  A modal SUDialog locks the DIAdem user interface until it is complete, avoiding all these messages and display checks.

 

R&D suggests putting the heavy lifting code into an external VBScript and calling it from the non-modal SUDialog with ScriptStart().  Any time ScriptStart() is called, a new VBScript engine is launched to execute that script, and the DIAdem user interface is locked until that script is complete.  I pulled most of the code from the button click callback Sub in your SUDialog and stuck them in an external VBScript, which the SUDialog nows calls with ScriptStart().  I find that your test code now runs at the same speed whether called as a modal SUDialog or used embedded in the VIEW Area.

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 7 of 8
(2,949 Views)

Thank you Brad for identifying a solution to this problem.  

 

I put together a set of files to demonstrate the problem and your proposed solution, and then posted them to my website.  My hope is that other DIAdem users will find this helpful.

 

http://www.savvydiademsolutions.com/dialog.php?topic=dialog-modal-vs-non-modal 

0 Kudos
Message 8 of 8
(2,909 Views)