04-24-2009 01:37 AM
I've been noticing significant but mysterious differences in speed between identical code run in mathscript nodes under OS-X and under XP. I have a MacBook with two copies of LabVIEW installed, one on OS-X, the other on XP (running VMWare Fusion). So the hardware is identical.
I made up two sample vi's. The first loops over fft in a mathscript node. (I take an fft of a random vector 2^16 long.) The second loops over lsim. (I input a random vector 2^12 long into a 2nd-order, undamped system.) On my MacBook, in 15s, I recorded the following numbers of iterations:
benchmark.vi (fft): OS-X 341; XP 109
benchmark1.vi (lsim): OS-X 58; XP 157
In other words, OS-X runs fft 3x faster than XP, while XP runs lsim 3x faster than OS-X!!
Any ideas on what's going on?
From previous discussions, I expect that replacing the mathscript nodes with native LabVIEW code would speed things up on both versions. I haven't tried that....
Note: I tried to attach the vi's but I kept getting an "unexpected error" from the NI server. I can email them to interested parties.
04-24-2009 08:26 AM
No ideas about the speed, but I would like to look at your code.
If you are using Safari, you may have trouble attaching VIs. Try converting them to a zip file or even appending a .txt suffix. If you do the .txt thing, please note that in your post so people know to strip it off. There is a known problem with Safari and Google Chrome which seems to be related to two-letter file extensions. Safari 4 (beta) does not seem to have the problem.
Lynn
04-24-2009 09:37 AM
04-24-2009 10:04 AM
You may be right. I have not used Fusion. I have a MacBook with Bootcamp. That runs Windows natively on the Apple hardware. So I will try the comparison on both sides of that machine.
Lynn
04-24-2009 10:42 AM
I've attached zipped versions of the vi's.
I'm not sure what the general issues of speed using VMWare Fusion are, but the interesting observation here is that there are 3:1 speed differences in BOTH directions. OS-X is 3x faster for fft, while XP is 3x faster for lsim.
04-24-2009 12:09 PM
I could not run either of the benchmark VIs. They wanted subVIs called CDMC_ss.vi, CDMC_Isim.vi and CDMC_ArithmeticOperatorToken_mpower.vi. Interestingly, the benchmark VI asks for the last of those, but does not have a broken run arrow after I told it to ignore the VI it could not find. Benchmark1.vi is more conventionally broken. I find many functions with the MC_ prefix but none with the CDMC_ prefix in the imath folder of vi.lib. The path it was searching included "Plug In: Control Design: ..." which I do not have in the imath folder.
Lynn
04-24-2009 12:45 PM
benchmark1 definitely needs the Control Design add-on (sorry, I should have mentioned that). I believe that benchmark.vi does not. I originally just had 1 vi and split the material into two separate vi's. Thus, I probably had saved benchmark.vi with lsim at one point and perhaps LabVIEW does not recognize that the add-on is no longer needed.
Could you try to copy the vi nodes, etc., in benchmark into a new vi and see whether that runs? That won't help for benchmark1, but it does suggest a reason for the discrepancy. Perhaps
1) The Mac version will be generally faster than XP running under VMWare Fusion.
2) Something in the Control Design add-on (OS-X version) is running considerably slower (it would have to be 9x slower in this scenario).
If any of the "official" NI folks see this (Grant M?), their input would also be welcome....
04-24-2009 02:01 PM
Your benchmark VIs test several things besides speed of the code: The operator's reaction time and screen updates.
Here is a speed test VI which compares the mathscript node with doing the same function in LV. Side note: This is one of the very few good uses for a sequence structure.
I find LV about five times faster on the Mac. I cannot test the Windows version until tonight.
Lynn
04-24-2009 04:30 PM
04-27-2009 08:27 AM
Did you mean LV 8.6? I don't think there was a version 6.8!
My dual boot computer is a non-boot computer at the moment so I have not been able to compare results under Bootcamp.
Generally native LV code is faster than any kind of script nodes. Sometimes highly optimized code running as a CIN or DLL can beat well written LV code.
Lynn