Recent

Author Topic: On RASPI, Python vs. Lazarus ?  (Read 3951 times)

alexflex

  • Newbie
  • Posts: 3
On RASPI, Python vs. Lazarus ?
« on: June 27, 2018, 03:16:23 pm »
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
« Last Edit: June 27, 2018, 04:46:12 pm by alexflex »

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: On RASPI, Python vs. Lazarus ?
« Reply #1 on: June 27, 2018, 05:49:05 pm »
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.
Specialize a type, not a var.

alexflex

  • Newbie
  • Posts: 3
Re: On RASPI, Python vs. Lazarus ?
« Reply #2 on: June 27, 2018, 06:30:15 pm »
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

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: On RASPI, Python vs. Lazarus ?
« Reply #3 on: June 27, 2018, 07:19:30 pm »
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.
« Last Edit: June 27, 2018, 09:07:02 pm by Thaddy »
Specialize a type, not a var.

alexflex

  • Newbie
  • Posts: 3
Re: On RASPI, Python vs. Lazarus ?
« Reply #4 on: June 27, 2018, 11:43:54 pm »
Waou Thaddy, thank you so much for giving me that so clear explanation !

Now things are very clear.

Alexis
 :)  :D

 

TinyPortal © 2005-2018