Forum > Linux

On RASPI, Python vs. Lazarus ?

(1/1)

alexflex:
Dear friends, thanks for this forum about my favorite
language Pascal, that I use for 30 years now !

Simple question :
I have a new program to do about MIDI music.
Is there anyone of you that tested the speed of Python vs. Lazarus for the same minimal task, (or on a Sound / MIDI music processing)
on RASPI ?

Thanks a lot for your answer
Alexis

Thaddy:
If both Python and FPC are calling the same low-level libraries, there is a slight speed advantage for FPC.
But in FPC you CAN write a midi library from the ground up, whereas that is not possible with Python. The latter relies on low-level capable languages to perform its art.
There is nothing wrong with that, but do not mix up low-level capable languages with what is essentially scripting.

alexflex:
Thanks a lot for your answer.
So if i may resume, coding in pure Python, and pure FCP gives a little speed advantage to FCP ?
Right ?

A.

Thaddy:
Yes.
But the main point you need to understand is that Python is not a complete language (it is Turing complete, but it can't compile itself, yet): it is a convenient way to use libraries written in other languages.(like fpc or C or  C++ or Haskell or whatever)
The perceived performce of Python comes from those libraries, not Python itself!!!
Python on itself can't do many things. Its libraries are not written in Python on the lowest level. Python is not written in Python....
That's the BIG difference. That said: I am using Python all the time! It's quick and nice, has a clean syntax and very easy to understand.

But in my case, (my!, old hand, freak, 40 years of Pascal)  fpc code outperforms Python most of the time and by a huge margin, but not always. That is not usually the case for beginners, I know.

alexflex:
Waou Thaddy, thank you so much for giving me that so clear explanation !

Now things are very clear.

Alexis
 :)  :D

Navigation

[0] Message Index

Go to full version