views:

253

answers:

3

i 'm just finish labs meeting with my advisor, previous code is written in matlab and it run offline mode not realtime mode, so i decide to convert to python+numpy (in offline version) but after labs meeting, my advisor raise issue about speed of realtime recognition, so i have doubt about speed of python+numpy to do this project. or better in c? my project is about using electronic glove (2x sensors) to get realtime data and do data processing, recognition process

+3  A: 

NumPy is very fast if you follow some basic rules. You should avoid Python loops, using the operators provided by NumPy instead whenever you can. This and this should be a good starting points.

After reading through that, why don't you write some simple code in both Matlab and NumPy and compare the performance? If it performs well in NumPy, it should be enough to convince your advisor, especially if the code is representative of the actual algorithms you are using in your project.

Note: you should also see that your algorithm really is suited for realtime recognition.

carnieri
+1  A: 

I think the answer depends on three things: how well you code in Matlab, how well you code in Python/Numpy, and your algorithm. Both Matlab and Python can be fast for number crunching if you're diligent about vectorizing everything and using library calls.

If your Matlab code is already very good I would be surprised if you saw much performance benefit moving to Numpy unless there's some specific idiom you can use to your advantage. You might not even see a large benefit moving to C. I this case your effort would likely be better spent tuning your algorithm.

If your Matlab code isn't so good you could 1) write better Matlab code, 2) rewrite in good Numpy code, or 3) rewrite in C.

Brian Hawkins
A: 
Denis