EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Labview vs. C++

Started by Tim Wescott July 20, 2016
OK.  Neither of the groups to which I'm cross-posting this are 
appropriate.

But, y'all are smart, and I know who to listen to.

Problem: I'm working on a proposal for a customer, for an app that's 
going to require heavy computation and is more or less real time*.  The 
guy I'll be working with the closest is pretty much a 100% LabView 
programmer -- he just doesn't _do_ C, or C++, or Fortran.

The customer wants me to deliver them an algorithm, to which they'll 
write code.  They're pretty firm (for good reason) on wanting to do the 
code in-house, or with local talent.  I'm trying to decide how hard I 
need to push, early on, for the computationally intensive bits to be done 
in C++.

I just Googled, and didn't find any good references on the relative 
speeds of doing things in some compiled language vs. Labview.  If the 
ratio is similar to what you get in Scilab or Matlab, then they need to 
go with C++.

So -- anyone know?  Any comments?

Thanks.

* It's not 100% hard real time, with an "exceed and you die" sort of 
deadline, but after the nominal deadline the slope of the user-crankiness 
vs. delay curve is pretty steep.  Moreover, while _occasional_ delays 
could be tolerated, if the computer just can't keep up then the delays 
will grow ever longer -- and the user ever crankier -- with time.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

I'm looking for work -- see my website!
Tim Wescott  <seemywebsite@myfooter.really> wrote:

> Problem: I'm working on a proposal for a customer, for an app that's > going to require heavy computation and is more or less real time*. The > guy I'll be working with the closest is pretty much a 100% LabView > programmer -- he just doesn't _do_ C, or C++, or Fortran.
> The customer wants me to deliver them an algorithm, to which they'll > write code. They're pretty firm (for good reason) on wanting to do the > code in-house, or with local talent.
Sounds good
> I'm trying to decide how hard I need to push, early on, for the > computationally intensive bits to be done in C++.
I would say, not at all, unless you think your failure to steer them on the issue might cause the project to collapse and negatively impact your future revenues; but even in this scenario you do not want to directly challenge their internal technical approach. I would recommend proposing to include a C++ program among your deliverables to them, so that they have a reference implementation. You may also want to propose a certain number of your hours as post-delivery support. Steve
On Wednesday, July 20, 2016 at 6:57:07 PM UTC-5, Tim Wescott wrote:
> OK. Neither of the groups to which I'm cross-posting this are > appropriate. > > But, y'all are smart, and I know who to listen to. > > Problem: I'm working on a proposal for a customer, for an app that's > going to require heavy computation and is more or less real time*. The > guy I'll be working with the closest is pretty much a 100% LabView > programmer -- he just doesn't _do_ C, or C++, or Fortran. > > The customer wants me to deliver them an algorithm, to which they'll > write code. They're pretty firm (for good reason) on wanting to do the > code in-house, or with local talent. I'm trying to decide how hard I > need to push, early on, for the computationally intensive bits to be done > in C++. > > I just Googled, and didn't find any good references on the relative > speeds of doing things in some compiled language vs. Labview. If the > ratio is similar to what you get in Scilab or Matlab, then they need to > go with C++. > > So -- anyone know? Any comments? > > Thanks. > > * It's not 100% hard real time, with an "exceed and you die" sort of > deadline, but after the nominal deadline the slope of the user-crankiness > vs. delay curve is pretty steep. Moreover, while _occasional_ delays > could be tolerated, if the computer just can't keep up then the delays > will grow ever longer -- and the user ever crankier -- with time. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com > > I'm looking for work -- see my website!
Most NI boards now days have a FPGA NI provides schematic based entry of FPGA code Looks like NI also allows VHDL or Verilog: http://www.ni.com/product-documentation/53056/en/ Which in the case of Vivado compilation allows C/C++ code as well? Also regards C++: https://decibel.ni.com/content/thread/1270 So quiz the customer as to whether FPGA computation is allowed If so, they may be planning to convert time critical C++ to FPGA fabric? (and determine how much VHDL/Verilog and Vivado you need to learn) Jim Brakefield
On 21.07.16 01.57, Tim Wescott wrote:
> I just Googled, and didn't find any good references on the relative > speeds of doing things in some compiled language vs. Labview. If the > ratio is similar to what you get in Scilab or Matlab, then they need to > go with C++.
There is no general factor. It depends. If you do an FFT in LabView it is probably almost as fast as your C++ code on the same hardware, since the kernel functions of LabView is C++ too and uses appropriate libraries. But simple code with loops in the LabView code can be quite slow if it requires many iterations. In this case I would expect up to 2 orders of magnitude. LabView is AFAIR more or less a functional language which easily can be executed on many CPU cores if some of the execution paths are independent. In contrast you need to do this job by yourself in C++. At the end it depends on the absolute required CPU power. As long as it fits below the desk paying for new hardware is almost always cheaper than paying for people to write smarter code. So only if recent hardware is not capable of the task in LabView there is a real need to switch to C++. A few days ago I ported a small code from Java to C++ (computing 4E9 numbers with a certain PRNG algorithm). The computation time reduced from several years to several days. (In fact the task was solvable with "Brain" in several minutes - but that's a whole different story.) Marcel
On 7/21/2016 12:37 AM, Marcel Mueller wrote:

> A few days ago I ported a small code from Java to C++ (computing 4E9 > numbers with a certain PRNG algorithm). The computation time reduced > from several years to several days.
This only says that the Java code was not well written at all. Current indications all point to Java being as fast (and sometimes even faster) than C and C++ these days. Just google it. One random link (July 18, 2016) http://blog.optionscity.com/java-vs.-c-performance-face-off-part-ii "In summary, it is clear that the raw performance of modern Java is equal to, if not superior to C++ systems, and that the quality of the code is the most important factor in the performance of the system." There are many more studies that indicate the same. Sure, there are area where C or C++ is still faster, but it will be few percentage points faster in those cases if any, not multiple of magnitudes faster. The days when Java was slow are long behind us. Choice between C/C++ and Java these days can no longer be about speed, but for other reasons specific to the project.
> (In fact the task was solvable with "Brain" in several minutes - but > that's a whole different story.) > > > Marcel >
Il giorno gioved&igrave; 21 luglio 2016 07:39:11 UTC+2, Marcel Mueller ha scritto:

> A few days ago I ported a small code from Java to C++ (computing 4E9 > numbers with a certain PRNG algorithm). The computation time reduced > from several years to several days. > (In fact the task was solvable with "Brain" in several minutes - but > that's a whole different story.)
very bad java implementation then. Bye Jack
Il giorno gioved&igrave; 21 luglio 2016 08:20:39 UTC+2, Nasser M. Abbasi ha scritto:

> There are many more studies that indicate the same. Sure, there > are area where C or C++ is still faster, but it will be > few percentage points faster in those cases if any, not > multiple of magnitudes faster. The days when Java was slow are > long behind us. Choice between C/C++ and Java these days
Java is still slow (er than native programs), but only when it has to interact with things outside the VM (OS, UI, files,...). Bye Jack
Il giorno gioved&igrave; 21 luglio 2016 01:57:07 UTC+2, Tim Wescott ha scritto:
> OK. Neither of the groups to which I'm cross-posting this are > appropriate. > > But, y'all are smart, and I know who to listen to. > > Problem: I'm working on a proposal for a customer, for an app that's > going to require heavy computation and is more or less real time*. The > guy I'll be working with the closest is pretty much a 100% LabView > programmer -- he just doesn't _do_ C, or C++, or Fortran.
well...
> The customer wants me to deliver them an algorithm, to which they'll > write code. They're pretty firm (for good reason) on wanting to do the > code in-house, or with local talent. I'm trying to decide how hard I > need to push, early on, for the computationally intensive bits to be done > in C++.
why C++? Because it's the only language you know? Anyway if they want the algorithm and want to do the implementation in house, well it's not your problem. Bye Jack
On Thu, 21 Jul 2016 00:17:30 +0000, Steve Pope wrote:

> Tim Wescott <seemywebsite@myfooter.really> wrote: > >> Problem: I'm working on a proposal for a customer, for an app that's >> going to require heavy computation and is more or less real time*. The >> guy I'll be working with the closest is pretty much a 100% LabView >> programmer -- he just doesn't _do_ C, or C++, or Fortran. > >> The customer wants me to deliver them an algorithm, to which they'll >> write code. They're pretty firm (for good reason) on wanting to do the >> code in-house, or with local talent. > > Sounds good > >> I'm trying to decide how hard I need to push, early on, for the >> computationally intensive bits to be done in C++. > > I would say, not at all, unless you think your failure to steer them on > the issue might cause the project to collapse and negatively impact your > future revenues; but even in this scenario you do not want to directly > challenge their internal technical approach.
My job is to point them in the direction of success. If that means that using the computing language they're comfortable with won't lead to success, then I need to point that out to them -- even if they don't like it. I won't beat them with a stick, but they need to understand.
> I would recommend proposing to include a C++ program among your > deliverables to them, so that they have a reference implementation. You > may also want to propose a certain number of your hours as post-delivery > support.
They specifically don't want to pay for that -- there will be a Scilab program, but that has run-times roughly comparable to Labview. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
On Thu, 21 Jul 2016 07:18:29 -0700, Jack wrote:

> Il giorno gioved&igrave; 21 luglio 2016 01:57:07 UTC+2, Tim Wescott ha scritto: >> OK. Neither of the groups to which I'm cross-posting this are >> appropriate. >> >> But, y'all are smart, and I know who to listen to. >> >> Problem: I'm working on a proposal for a customer, for an app that's >> going to require heavy computation and is more or less real time*. The >> guy I'll be working with the closest is pretty much a 100% LabView >> programmer -- he just doesn't _do_ C, or C++, or Fortran. > > well... > >> The customer wants me to deliver them an algorithm, to which they'll >> write code. They're pretty firm (for good reason) on wanting to do the >> code in-house, or with local talent. I'm trying to decide how hard I >> need to push, early on, for the computationally intensive bits to be >> done in C++. > > why C++? Because it's the only language you know?
C++ is the language I know, yes, but if the customer wants to do it in Fortran, or if it can be made fast enough in Java or Python or whatever, then that's fine too. Left to their own devices they'll try it in Labview, which carries far more risk of it not keeping up.
> Anyway if they want the algorithm and want to do the implementation in > house, well it's not your problem.
My "problem" isn't to meet the terms of the contract and successfully demand payment. My "problem" is to help my customer succeed. As an entirely-to-the-point example, the one time that I've ever rebuilt a trailer hitch was when a customer of my father's showed up with a slammed '50 Merc and a trailer, to pick up a car body he'd just bought. The trailer hitch was such a disaster that my dad told him we wouldn't load the trailer until it was up to snuff. Then he detailed me to wallow around in the gravel underneath the car, with about a foot of room (because the TALL jackstands were in use) redesigning and rebuilding the trailer hitch so that it'd make the trip back to the guy's house. (Thanks, Dad). Why? Because for an ethical businessman the _goal_ is customer success. Money is just the byproduct that feeds the kid and staves off the bank. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!

The 2024 Embedded Online Conference