Compile Python, Matlab and Python

  • Context: MATLAB 
  • Thread starter Thread starter Winzer
  • Start date Start date
  • Tags Tags
    Matlab Python
Click For Summary

Discussion Overview

The discussion revolves around the performance of Python compared to Matlab and Mathematica when processing large data arrays, as well as the possibility of compiling Python code to improve execution speed. Participants explore various tools and methods for compiling Python and integrating it with C++ applications.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants inquire about methods to compile Python code to enhance processing speed, noting that Python is an interpreted language.
  • There is a suggestion to investigate Psyco as a potential tool for compiling Python, although one participant admits to having no experience with it.
  • Participants express that the speed of processing large arrays in Python (with numpy and scipy), Matlab, and Mathematica may depend on specific tasks and the optimization of the programs used.
  • Memory usage considerations for both data and the running program are highlighted as important factors in determining performance.
  • One participant raises a question about the feasibility of compiling Python code into machine code and using it within a C++ application, prompting further exploration of the topic.
  • Another participant mentions PyPy as an interesting alternative for Python compilation.
  • There is a suggestion to use py2exe for compiling Python into an executable on Windows.
  • Participants discuss the possibility of having Python scripts communicate with C++ programs through sockets, rather than directly integrating code.

Areas of Agreement / Disagreement

Participants generally agree that the performance of different programming environments can vary based on specific tasks and optimizations, but no consensus is reached on the best approach or tool for compiling Python or integrating it with C++.

Contextual Notes

Limitations include the lack of specific examples or benchmarks to support claims about performance differences and the need for further clarification on the integration of Python with C++ applications.

Winzer
Messages
597
Reaction score
0
1) I know that python is an interpreted language. But is there a way to compile to code to make it process faster?

2) Suppose I have a huge array of data. I want to process it. If I were to run the process through python(with numpy and scipy), Matlab, and Mathematica which one would be able to process it the fastest?
 
Physics news on Phys.org
Winzer said:
1) I know that python is an interpreted language. But is there a way to compile to code to make it process faster?

You might look into http://psyco.sourceforge.net/ .
I have no experience with it. Please report back if it works.

2) Suppose I have a huge array of data. I want to process it. If I were to run the process through python(with numpy and scipy), Matlab, and Mathematica which one would be able to process it the fastest?

I think the answer to this really depends on
what specific tasks you want done
and how optimized your program is [with respect to the platform chosen].

You may have to also consider memory usage for your data (including data structures) and memory usage and overhead for the running program.
 
robphy said:
You might look into http://psyco.sourceforge.net/ .
I have no experience with it. Please report back if it works.
I think the answer to this really depends on
what specific tasks you want done
and how optimized your program is [with respect to the platform chosen].

You may have to also consider memory usage for your data (including data structures) and memory usage and overhead for the running program.
Thank you. Psyco looks very interesting. So does PyPy.

Another question is:
If compilers convert Java,C++,C to the same machine code(I don't know if they really do), and if I were to use a program to compile some Python file into machine code, could I use that code in some C++ application?
 
If you're looking to compile into an executable, and are on windows, check http://www.py2exe.org/

What do you mean by use some python code in c++? If you mean to have your python script talk with your c++ program, you can simply have them communicate through sockets.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
Replies
5
Views
3K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 17 ·
Replies
17
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K