LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing function: memory copy

Hi,

Perhaps this should be posted to the feature request forum, but I really
like some discussion on the subject as well...

I'm making some compression and decompression algorithms, and am finding
that the C implementations are a factor 10 faster. I always claimed myself
that G code can be nearly as fast as C code, but in this case, I really
think it can't be as fast... I really don't want to use external routines,
since they are not platform independent.

The algorithms typically use a table that stores data. This data is then
copied to the output. That's a very simple description, in fact it's much
more complex.

In C, you can simply copy from one array to another, and this is just as
fast as any other copy. If you copy a number of values, it might even be
faster, since you get caching benefits and perhaps even mmx stuff kicking
in.

In G, there is no way to copy from one array to another, without first
making a new array. This really eats away processor time. So, why isn't
there a node that has one source array (in), one destination array (in/out),
an index (in) and length (in)? Or is there another solution to this in pure
G (I don't think so, but you never know)? This shouldn't be hard to make for
NI, but impossible for us, G programmers...

Regards,

Wiebe.


Message 1 of 34
(3,742 Views)

You can't do that with the in-place memory operators?

 

Could you post a code example to demosntrate whay you wna to do but can't?

 

Confused,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 34
(3,724 Views)

So, why isn't there a node that has one source array (in), one destination array (in/out), an index (in) and length (in)? 

 

 

There is:

Pic

 

 
 
 
 
Message Edited by CoastalMaineBird on 03-23-2009 06:36 AM
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 3 of 34
(3,711 Views)

This is very slow, compared to how C does it. This is because the array subset has to be created, before it is inserted into the other array.

 

 

Regards,

 

Wiebe.

MemCopy

Message Edited by wiebe@CARYA on 03-23-2009 07:27 AM
0 Kudos
Message 4 of 34
(3,697 Views)

..and this is what I would like to have...

 

 

So instead of:

Creating a new buffer allocation

The subset is copied to this new buffer allocation

Copy the new buffer to the destination array

 

We can simply:

 Move the data from source to destination.

 

Message Edited by wiebe@CARYA on 03-23-2009 07:40 AM
Message 5 of 34
(3,689 Views)