+ 11

The fastest programming language

hi dear friends i should write a very big code for my master thesis the most important factor in my code is run time this code should calculate many mathematic problems that is based on matrix calculation and is very huge (for FEM in engineering ) please help me which one of programming language is the fastest for my problem and i can decrease run time in it(compared with other language)

14th Jun 2018, 5:30 PM
Ehsan Fakharzadeh
Ehsan Fakharzadeh - avatar
42 Answers
+ 8
C ànd C++👍
17th Jun 2018, 9:37 AM
💞ⓢⓦⓐⓣⓘ💞
💞ⓢⓦⓐⓣⓘ💞 - avatar
+ 6
Use python numpy library, or tensorflow. They are written on C, and good optimized for matrix calculation.
17th Jun 2018, 9:46 AM
Gurgen Avagyan
Gurgen Avagyan - avatar
+ 5
If runtime speed is important, C or C++ is a good candidate. The performance will also depend on the compiler. Now, maybe you can be clever about it, and write only the bit that needs to be fast in C, and create a library that you can call from a larger wrapper program written in another language, such as python. Also, I am assuming that it is up to you to write the fast code. if this is not the case, and you are only interested in the outcome of number crunching, you may want to look for existing math libraries that you could reuse. See the following link for some more considerations https://stackoverflow.com/questions/6955114/is-c-notably-faster-than-c
14th Jun 2018, 7:44 PM
ifl
ifl - avatar
+ 4
how is c++??? assembly is very hard because in next step i should change my code for parallel computation and i thank working with assembly is very hard in this step is it true??
14th Jun 2018, 5:38 PM
Ehsan Fakharzadeh
Ehsan Fakharzadeh - avatar
+ 4
I recommend c++ for efficiency || Python for simplicity
16th Jun 2018, 12:06 AM
Hope Johnson
Hope Johnson - avatar
+ 4
C!
17th Jun 2018, 8:40 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 4
Haris what i mean is python has simple syntax and making big codes is easier and fast... not Purely fast compiling.
17th Jun 2018, 9:21 AM
Ali
Ali - avatar
+ 4
Ali Oh, I see. However at the question he says he has to write a big code for his thesis. In my humble opinion C style syntax is best for big codes because curly braces make it easy to see where a code block starts and ends. Whereas python syntax doesn't facilitate that.
17th Jun 2018, 9:38 AM
Haris
Haris - avatar
+ 4
assembly, C++ or maybe Fortran. C++ is C with additional optional features. And these days, C++ compilers produce often faster code than C compilers. Never touched Fortran, so I don't know if it's better. But don't do the performance critical work in Python.
17th Jun 2018, 10:56 AM
Timon Paßlick
+ 3
if you need to do numeric work you should also consider fortran (depending on your field of course) since there are large very optimized codebases of numeric code in fortran going back as far as the 50s. the other candidate would be C/C++ and you should probably prefer it if there is no specific code in fortran you need to use in your work that doesn‘t have c/c++ bindings available. look into the intel compilers if your code is running on a x86 related platform they are known for producing fast numeric code http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/ matrix libraries you should look into: Blitz++ LAPACK
14th Jun 2018, 8:59 PM
Max
Max - avatar
+ 3
C++ for speed.
16th Jun 2018, 7:16 AM
Haris
Haris - avatar
+ 3
If you would work with many complex arithmatic formulas and it's very massive to solve them 'mathlab' has many powerful functions to solve them simply but if you want to do it quikly first "python " and and second "C++" will helpful for you. good luck!
17th Jun 2018, 5:56 AM
Ali
Ali - avatar
+ 3
Ali Python first for speed... What?
17th Jun 2018, 8:58 AM
Haris
Haris - avatar
+ 3
Some big companies use python, with C++ in the areas where memory management or additional performance is required : https://realpython.com/world-class-companies-using-python/
17th Jun 2018, 9:58 AM
ifl
ifl - avatar
+ 3
Well yes, if your research is about creating algorithms, C/C++ is the way forward (I don't know fortran, so can't comment) It may be part of your research to compare the speed of your code with what you can get from numpy or other existing solutions ! 😁
17th Jun 2018, 12:15 PM
ifl
ifl - avatar
+ 3
Whatever you do, the choice of compiler and underlying math libraries is also important. For example, Intel has good resources, optimized for their processors.
17th Jun 2018, 1:28 PM
ifl
ifl - avatar
+ 2
Don't knowing this time.....
16th Jun 2018, 11:12 AM
Amerendra Kumar
Amerendra Kumar - avatar
+ 2
C & C++
17th Jun 2018, 5:34 AM
R3d R0k37
R3d R0k37 - avatar
+ 2
Haris, maybe @Ali means : prototyping in python?
17th Jun 2018, 9:01 AM
ifl
ifl - avatar
+ 2
Ehsan Fakharzadeh python numpy will not be faster, for huge matrix stuff fortran with lapack is probably best
17th Jun 2018, 12:07 PM
Max
Max - avatar