LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

variant data size in Netork STREAM RT to PC

Hello,

 

I want to develop an universal Network stream subVI that can be used to transfer any type of data, depending on what data type you connect.
I found that I should use Variant Type and I have done it.

But there is a problem that my application performance is slower now. I even used GetTimeStamp and it seems that time between loop has changed from 356us for U8 data to 2212us for Variant type, where I connected U8 too.
Communication is working, but there is no difference in send time if I send U64 of U8.
Transmission is slower in comparicon to program with fixed U8 connected.

Maybe I am doing wronk with that type. How can I manage with that?
Or there is no option to do that because variant type reserves the biggest size.

Pieces of code:

ON RT:

RT.PNG

 

ON PC:
PC.PNG

 

Best regards,

Chris

0 Kudos
Message 1 of 6
(2,751 Views)

A variant does not have a fixed size, therefore there is more memory activity involved.  The U8 and U64 are fixed sizes, so some shortcuts can be made.  You really should used fixed sized items if you really care about performance.  Strings and arrays should have this same issue.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(2,750 Views)

Yup, Varient is not the way to go here!  this is one of those times you want a polymorphic vi and force the developer to determine data type before compile.

 

Yes the developers will howl!  you can beat them into submission-  making the developers happy in this case will disapoint the USERS- beating users into submission is considered "Bad Form."  Eventually the users go somewhere else and the heretofore happy developers need to seek other employment.


"Should be" isn't "Is" -Jay
Message 3 of 6
(2,740 Views)

I do understand that.

I am still searching for optimal solution to make it universal for any connected data type.

I have tried to make an Enum Case selector on Network Stream Endpoint Create but it failed because the reference passed later depends on datatype.

Now I am thinking to make a Polimorphic VI, but then I am supposed to build a VI for any data Type that I might use and then apply it in one. That is still  a big waste of memory for the code that is the same for the every type.

Maybe someone knows different solution?

0 Kudos
Message 4 of 6
(2,727 Views)

@BiedaK wrote:

Now I am thinking to make a Polimorphic VI, but then I am supposed to build a VI for any data Type that I might use and then apply it in one. That is still  a big waste of memory for the code that is the same for the every type.

 


Well, that is the drawback to polymorphic vis.  it breaks the "Code it once" rule untill you consider type propigation.  Polys are harder to maintain than your average vi.   In this case i'd still go with the poly.  The performance trade-off is worth your suffering- and usually when you create a poly you mock-up one instance first- thoughly test and document it, Make it pretty! then do some "Saving-As" magic and thank the IE for the ability to change Representation on multiple numerics in one right-click. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 6
(2,717 Views)

Jeff·Þ·Bohrer wrote:  then do some "Saving-As" magic and thank the IE for the ability to change Representation on multiple numerics in one right-click. 

That's too much work.  Make a scripting VI to do it for you!  I made this one to handle all of the numerics.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 6
(2,715 Views)