06-08-2023 03:15 PM
I need to run a measurement using both matlab and python. Since I have a custom use case I used the c API to write a dll that creates a task and then per request starts the task, reads the data and stops the task. The block I care about performance-wise is the start-read-stop part. This (for my typical parameters of rate, channel & sample num) takes ~100 ms running it from full C++ code or from the matlab interface. In python, for some reason, it takes more than 200 ms. The times I mention here are just the execution as reported in the I/O trace log.
In the attached traces:
First block create to clear is C++.
Second is matlab.
Third is python.
I just can't understand why the same code, running the same function from NIDAQmx c api takes more time if it happened to be called from python. I'd really appriciate it if anyone has any idea why this happens and how I can get around that.
06-08-2023 03:51 PM
Because Python is an interpreter language while C is pre-compiled.
Python vs C: Top 12 Differences You Must Know
06-09-2023 12:39 AM
That would explain the overall run time difference. In my case there’s some function (python/ matlab/ C++) calling a dll in C++ which calls NIDAQmx dll function. Why does the NIDAQmx performance depend on the caller?