Hello!
I am working on bigger application but I reduced it to show You a problem which I encounter at the beginning. I attach all the files needed to run.
This is simple rgb2monochrome algorithm which I implemented in C code and LabVIEW code. I don't now why C code is 4 times faster.
In C code I transfer arrays with pointers so I am working on certain area of memory. I thought that LabVIEW may be slower because it creates some unnecessary copies of arrays. I tried to solve this with In Place Element Structure and Data Value Reference but no effect.
I also tried to change tunnels into shift registers in some places (read in the Optimizing LabVIEW Embedded Applications). I changed options in Execution Properties of subVIs and I built EXE application to see if it will be faster. Unfortunately I still can't reduce diffrence between execution times.
I know that my algorithm may be better optimized but this is not main problem. Now both algorithm are implemented in the same way (You can check in cpp file) so they should have similar execution times. I think I did some mistake in LabVIEW code, maybe something with memory management?
And I have one more idea... Maybe nothing bad with LabVIEW code but something too good in C code ? It is 64b library, implemented in normal way without forcing parallelism. Moreover i mark run in UI thread in CLFN. But maybe even so CPU handles this function with multi cores? I have 4 cores so then the difference in the execution times would be okay
. But it is impossible, right?
I know opinions that LabVIEW sometimes is slower but about 15%, not 4 times. So I had to make some mistake... Someone knows what kind of ?
Regards,
ksiadz13