Recent

Author Topic: Why isn't Lazarus / Free Pascal more popular?  (Read 18072 times)

JD

  • Hero Member
  • *****
  • Posts: 1905
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #135 on: May 08, 2025, 09:50:09 pm »
When I tell people I use pascal they run away. Literally.

In my case, it was laughter and unbelief. But once I showed them how it can be integrated into a modern full stack software design (in my case on the server side) with containers and VPS, the smiles were wiped off their faces. And when it performs very well in that environment on legacy machines with a reasonable amount of RAM, no one cares about what language is used anymore. The tool becomes less important if the problem is solved except for large corporates for maintainance reasons.

The Object Pascal language  is likely to remain a niche language. I don't think it will disappear. In the last couple of days, I've noticed newer channels on YouTube teaching/promoting products with Lazarus/FPC. Some of the channels are in Portuguese and Spanish due to South American market especially in Brazil and also in Argentina. That in my opinion is a very welcome development.
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

silvercoder70

  • Full Member
  • ***
  • Posts: 183
    • Tim Coates
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #136 on: May 09, 2025, 12:23:26 am »
Pascal (in some form or another) has been around for a while and will remain for a while yet where others might come and then disappear. I can also say there are both positive and negative connotations about Pascal being niche.

Anyway, I have started a thread here -

https://forum.lazarus.freepascal.org/index.php/topic,71081.msg554279/topicseen.html

on "Practical Ways to Help Lazarus and Free Pascal Thrive" where we can all contribute ideas. And I guess the question also turns into

What you do you want the language to become?
🔥 Pascal Isn’t Dead -> See What It Can Do: @silvercoder70 on YouTube

Lenny33

  • New Member
  • *
  • Posts: 37
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #137 on: May 10, 2025, 06:06:47 am »
I will explain you like a 5-years-old:

Here we are comparing the performance of C++ vs FPC.

Example: If you use assembler to optimize FPC code but you do not use assembler to optimize C++ code then you can not say "FPC is faster!"

You need to use assembler in both codes (or not use it in any of them) for a reliable comparison.
It is useless to explain this to fanatics of only one programming language.
People like Seenkao do not understand 2 things:
1) Nowadays it is almost impossible to write assembly code better than well optimizing compilers can do, f.ex. like VC++ or especially Intel C++ for x86 architecture;
2) No one wants to spend hours on manual optimization if the compiler itself can do it for a seconds. And especially for different processor generations and different architectures.

Unfortunately, existing Pascal compilers cannot boast of good optimization of computational algorithms.
Therefore, nobody uses them in tasks that require intensive computations. Obviously except Seenkao and maybe few others who like to write everything by hand in assembly language in 2025.

Thaddy

  • Hero Member
  • *****
  • Posts: 16959
  • Ceterum censeo Trump esse delendam
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #138 on: May 10, 2025, 09:03:41 am »
A five year old would know that the compilers should in theory compile to binaries of equal speed.
It is not the language. Anyone who does not understand that is less than four years old.
(In some fields, fpc can beat C++ compilers, but that is really not relevant, because it is implementation detail)
« Last Edit: May 10, 2025, 09:12:43 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

LV

  • Sr. Member
  • ****
  • Posts: 272
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #139 on: May 10, 2025, 01:12:35 pm »
1) Nowadays it is almost impossible to write assembly code better than well optimizing compilers can do, f.ex. like VC++ or especially Intel C++ for x86 architecture;
2) No one wants to spend hours on manual optimization if the compiler itself can do it for a seconds. And especially for different processor generations and different architectures.

If you are involved in high-performance computing, you may have examined the source code of mathematical libraries, much of which is written in assembly language.
https://github.com/OpenMathLib/OpenBLAS/blob/develop/kernel/x86_64/sum.S
Let's take a simpler approach and write a basic test for those uncomfortable with assembly language, AVX, or multithreading.

Code: C++  [Select][+][-]
  1. #include <iostream>
  2. #include <vector>
  3. #include <chrono>
  4. #include <cstdlib>
  5. #include <cmath>
  6.  
  7. constexpr int MATRIX_SIZE = 1000;
  8. constexpr int MATRIX_ELEMENTS = MATRIX_SIZE * MATRIX_SIZE;
  9.  
  10. void transpose_matrix(const std::vector<double>& src, std::vector<double>& dst) {
  11.     for (int i = 0; i < MATRIX_SIZE; ++i) {
  12.         for (int j = 0; j < MATRIX_SIZE; ++j) {
  13.             dst[j * MATRIX_SIZE + i] = src[i * MATRIX_SIZE + j];
  14.         }
  15.     }
  16. }
  17.  
  18. void naive_matrix_mult_transposed_unrolled(const std::vector<double>& a, const std::vector<double>& bT, std::vector<double>& c) {
  19.     for (int i = 0; i < MATRIX_SIZE; ++i) {
  20.         for (int j = 0; j < MATRIX_SIZE; ++j) {
  21.             double sum = 0.0;
  22.             int k = 0;
  23.  
  24.             // unroll by 4
  25.             for (; k <= MATRIX_SIZE - 4; k += 4) {
  26.                 sum += a[i * MATRIX_SIZE + k]     * bT[j * MATRIX_SIZE + k];
  27.                 sum += a[i * MATRIX_SIZE + k + 1] * bT[j * MATRIX_SIZE + k + 1];
  28.                 sum += a[i * MATRIX_SIZE + k + 2] * bT[j * MATRIX_SIZE + k + 2];
  29.                 sum += a[i * MATRIX_SIZE + k + 3] * bT[j * MATRIX_SIZE + k + 3];
  30.             }
  31.  
  32.             // tail loop for remaining elements
  33.             for (; k < MATRIX_SIZE; ++k) {
  34.                 sum += a[i * MATRIX_SIZE + k] * bT[j * MATRIX_SIZE + k];
  35.             }
  36.  
  37.             c[i * MATRIX_SIZE + j] = sum;
  38.         }
  39.     }
  40. }
  41.  
  42. int main() {
  43.     std::vector<double> a(MATRIX_ELEMENTS);
  44.     std::vector<double> b(MATRIX_ELEMENTS);
  45.     std::vector<double> b_transposed(MATRIX_ELEMENTS);
  46.     std::vector<double> c(MATRIX_ELEMENTS);
  47.  
  48.     srand(static_cast<unsigned>(time(nullptr)));
  49.     for (int i = 0; i < MATRIX_ELEMENTS; ++i) {
  50.         a[i] = static_cast<double>(rand()) / RAND_MAX * 100.0;
  51.         b[i] = static_cast<double>(rand()) / RAND_MAX * 100.0;
  52.     }
  53.  
  54.     transpose_matrix(b, b_transposed);
  55.  
  56.     auto start = std::chrono::high_resolution_clock::now();
  57.     naive_matrix_mult_transposed_unrolled(a, b_transposed, c);
  58.     auto end = std::chrono::high_resolution_clock::now();
  59.     std::chrono::duration<double, std::milli> exec_time = end - start;
  60.  
  61.     std::cout << "C++: Naive (transposed B, unrolled) multiplication time, ms: " << int(exec_time.count()) << std::endl;
  62.  
  63.     return 0;
  64. }
  65.  

Code: Pascal  [Select][+][-]
  1. program MatrixMultUnrolled;
  2.  
  3. uses
  4.   SysUtils,
  5.   DateUtils;
  6.  
  7. const
  8.   MATRIX_SIZE = 1000;
  9.  
  10. type
  11.   TMatrix = array of double;
  12.  
  13.   procedure TransposeMatrix(const src: TMatrix; var dst: TMatrix);
  14.   var
  15.     i, j: integer;
  16.   begin
  17.     for i := 0 to MATRIX_SIZE - 1 do
  18.       for j := 0 to MATRIX_SIZE - 1 do
  19.         dst[j * MATRIX_SIZE + i] := src[i * MATRIX_SIZE + j];
  20.   end;
  21.  
  22.   procedure NaiveMatrixMultTransposedUnrolled(const a, bT: TMatrix; var c: TMatrix);
  23.   var
  24.     i, j, k: integer;
  25.     sum: double;
  26.   begin
  27.     for i := 0 to MATRIX_SIZE - 1 do
  28.       for j := 0 to MATRIX_SIZE - 1 do
  29.       begin
  30.         sum := 0.0;
  31.         k := 0;
  32.         while k <= MATRIX_SIZE - 4 do
  33.         begin
  34.           sum := sum + a[i * MATRIX_SIZE + k] * bT[j * MATRIX_SIZE + k];
  35.           sum := sum + a[i * MATRIX_SIZE + k + 1] * bT[j * MATRIX_SIZE + k + 1];
  36.           sum := sum + a[i * MATRIX_SIZE + k + 2] * bT[j * MATRIX_SIZE + k + 2];
  37.           sum := sum + a[i * MATRIX_SIZE + k + 3] * bT[j * MATRIX_SIZE + k + 3];
  38.           Inc(k, 4);
  39.         end;
  40.         while k < MATRIX_SIZE do
  41.         begin
  42.           sum := sum + a[i * MATRIX_SIZE + k] * bT[j * MATRIX_SIZE + k];
  43.           Inc(k);
  44.         end;
  45.         c[i * MATRIX_SIZE + j] := sum;
  46.       end;
  47.   end;
  48.  
  49.   procedure FillRandomMatrix(var mat: TMatrix);
  50.   var
  51.     i: integer;
  52.   begin
  53.     for i := 0 to High(mat) do
  54.       mat[i] := Random * 100.0;
  55.   end;
  56.  
  57. var
  58.   a, b, bT, c: TMatrix;
  59.   startTime, endTime: TDateTime;
  60. begin
  61.   SetLength(a, MATRIX_SIZE * MATRIX_SIZE);
  62.   SetLength(b, MATRIX_SIZE * MATRIX_SIZE);
  63.   SetLength(bT, MATRIX_SIZE * MATRIX_SIZE);
  64.   SetLength(c, MATRIX_SIZE * MATRIX_SIZE);
  65.  
  66.   Randomize;
  67.   FillRandomMatrix(a);
  68.   FillRandomMatrix(b);
  69.   TransposeMatrix(b, bT);
  70.  
  71.   startTime := Now;
  72.   NaiveMatrixMultTransposedUnrolled(a, bT, c);
  73.   endTime := Now;
  74.  
  75.   WriteLn('FCP: Naive (transposed B, unrolled) multiplication time, ms: ',
  76.  
  77.   MilliSecondsBetween(endTime, startTime));
  78.  
  79.   Readln;
  80. end.
  81.  

Here are the results averaged over five runs of the programs
Code: Text  [Select][+][-]
  1. -------------------------------------------------------------------------
  2.             |  FPC 3.2.2 (-O3) |   C++ (GCC 14.2.0 -O3) | difference    |
  3. -------------------------------------------------------------------------
  4. Time, ms    |  972             |   924                  |      5%       |
  5. -------------------------------------------------------------------------
  6.  

P.S. Sorry, but I'm not interested in discussing who is a fan of a particular programming language. :)

JdeHaan

  • Full Member
  • ***
  • Posts: 161
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #140 on: May 10, 2025, 02:49:32 pm »
Testing your program MatrixMultUnrolled on my 2019 MBP-Intel I7 and MacOS Sequoia, and Lazarus+FPC trunk.

If I use {$mode ObjFPC) I get 1049 msec.
However if I use {$mode delphi} it takes 2279 msec. - twice as long...

Both in -O3

Can someone else confirm this?



LV

  • Sr. Member
  • ****
  • Posts: 272
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #141 on: May 10, 2025, 03:31:10 pm »
I tested with compiler directives {$mode ObjFPC} and {$mode delphi} for configuration: 

Lazarus 3.4 (rev lazarus_3_4) FPC 3.2.2 x86_64-win64-win32/win64
on Windows 11 (Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz).

The results are the same as those shown in the table above.

Lenny33

  • New Member
  • *
  • Posts: 37
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #142 on: May 10, 2025, 04:36:13 pm »
If you are involved in high-performance computing, you may have examined the source code of mathematical libraries, much of which is written in assembly language.
I have already written that our application among other things uses a lot of calculations for signal processing.
Experimentally it was found that the same algorithms compiled in VC++ for Win work almost twice as fast. Why this happens is obvious from what was given in this forum thread.
To achieve comparable speed on FPC or Delphi, some characters of this forum suggest manual optimization or even rewriting critical parts in assembler. But why?
It is much easier and much faster for us to write these parts of the program as C++ libraries. And the result is still better.

And now if we go back to the question, why isn't Lazarus(FPC) so popular?
So let's at least outline for ourselves the niche for Lazarus.

On the one hand, it is naive and does not require a managed environment for execution, but on the other hand, my opponents tell me that C++ also native, but generate more fast naive code.
Then why they should bother with hand memory management and so on if the performance of Lazarus apps is actually not higher than in f.ex. C#?

On the other hand Lazarus provides a good and free IDE with many libraries and components. But my opponents can say that VS Community Edition is also free and even more convenient (of cause if only on Win).
And there is also conditionally free Qt for C++, where the library is much more extensive, there is a more modern approach to interfaces ( QML ). And so on.
Yes, from the point of view of a completely free license Lazarus will definitely win, but is it so important for a serious commercial project? Licenses are usually cheaper than programmer salaries and other overheads.

What can be written in Lazarus FPC that could not be written in, for example, C#? I don't have an answer. The speed is almost the same. Computational algorithms +/- run at the same speed.
Maybe only very heavily loaded servers are better written in a naive language with no gabage collection. But practice shows that C# and even Node.js can handle such tasks quite well.
More then there are a huge number of commercial and free libraries on the C# side. And you can make projects directly for WEB out of the box (ASP.NET / Razor / Blazor ).
If only backend, then .NET Core is as free as Lazarus.

P.S. Sorry, but I'm not interested in discussing who is a fan of a particular programming language. :)
So in connection with the above:
let's start by admitting at least to ourselves that it's primarily about programming language. Most of us are old enough. We've liked Pascal language since school or university.
And we like the approach of creating interfaces interactively rather than declaratively, even though LCL/VCL interfaces are becoming obsolete.

Can FPC/Lazarus become more popular against this backdrop?
I don't know. Time will tell. There needs to be a serious investsments. But where to get it from in an opensource project?
IMHO If Delphi manages to rise in popularity Lazarus will rise with it.

« Last Edit: May 10, 2025, 04:55:24 pm by Lenny33 »

munair

  • Hero Member
  • *****
  • Posts: 855
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #143 on: May 10, 2025, 05:12:21 pm »
What can be written in Lazarus FPC that could not be written in, for example, C#? I don't have an answer. The speed is almost the same. Computational algorithms +/- run at the same speed.
Maybe only very heavily loaded servers are better written in a naive language with no garbage collection. But practice shows that C# and even Node.js can handle such tasks quite well.
More then there are a huge number of commercial and free libraries on the C# side. And you can make projects directly for WEB out of the box (ASP.NET / Razor / Blazor ).
If only backend, then .NET Core is as free as Lazarus.

One very good reason to use Lazarus/FPC as a RAD is its cross-platform support. It is one of the main reasons I use it, to cross compile with relative ease, especially on Linux where I start out developing most of my projects. So while speed can be an argument to use specific development tools, there are also practical considerations. And the code FPC generates is definitely NOT slow.
It's only logical.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1422
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #144 on: May 10, 2025, 11:12:45 pm »
There is nothing wrong with fpc/Lazarus, It’s great software! .. however the number of people using it and the places you can go to get help with using it are shrinking.  :(

 I just had to tell someone a moment ago that I could not help him with something and the people who could have abandoned us. Seven years ago there was a lot more support for people using fpc who needed help.
I could care less about downloading statistics.The majority of those are not real people who show up and make a programming community.

It’s extremely demoralizing to both established and potential fpc users When places that once provided excellent support are abandoned. It has become obvious that the only people who seemingly could solve this problem are not going to or unable to. It doesn’t matter which one it is. The results are the same. The result is a perception of a project with a shrinking number of users where most of the user accounts never talk.

All official support is now limited to a difficult to use mailing list and this forum which is great IF you don’t happen need support on a day when we are getting ddosed and don’t mind encounters with grouchy old men who might come to your thread to share their unsolicited off topic opinions about your code.

Seven years ago I could not have imagined the official support on other platforms disappearing. Maybe seven years from now this forum will be gone as well. Who knows. Things people need just tend to disappear...

Instead of worrying about getting new people to use fpc it would be more productive to try to treat other people who are still using fpc better. Why would anyone want to join a community that looks like it’s disappearing and some of the remaining people have flame wars in the remaining support forums?
« Last Edit: May 11, 2025, 12:06:15 am by Joanna from IRC »
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

440bx

  • Hero Member
  • *****
  • Posts: 5302
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #145 on: May 11, 2025, 01:14:29 am »
What can be written in Lazarus FPC that could not be written in, for example, C#? I don't have an answer. The speed is almost the same. Computational algorithms +/- run at the same speed.
Maybe only very heavily loaded servers are better written in a naive language with no gabage collection. But practice shows that C# and even Node.js can handle such tasks quite well.
C# code does not run nearly at the speed of compiled FPC code.  Not completely sure but I think MS Visual Studio is written mostly in C# and unless you have a _really fast_ machine, it is barely usable.  It is barely usable on a 2.8Ghz machine.  When code doesn't run well on a 2.8Ghz, my opinion of it is "rather low".    I know because I use it and I have a 2.8 Ghz machine which I have no intention of upgrading because it's more than fast enough to execute the code I write in the blink of an eye and, if my code runs fast on my box, it will be faster than water sliding on greased teflon on today's machines.

Garbage collection is the last "feature" I'd like to have in a language.  I can and do my own memory management a hundred times better (and that's a sharp understatement) than any garbage collector, not to mention that I don't need to program like I'm walking on eggshells because the garbage collector cannot correctly handle what I want to do.   That's not what I call a programming language.  Garbage collected languages are toys for wannabe programmers. 
« Last Edit: May 11, 2025, 01:18:09 am by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

LV

  • Sr. Member
  • ****
  • Posts: 272
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #146 on: May 11, 2025, 08:22:19 am »
I have already written that our application among other things uses a lot of calculations for signal processing.
Experimentally it was found that the same algorithms compiled in VC++ for Win work almost twice as fast. Why this happens is obvious from what was given in this forum thread.
To achieve comparable speed on FPC or Delphi, some characters of this forum suggest manual optimization or even rewriting critical parts in assembler. But why?
It is much easier and much faster for us to write these parts of the program as C++ libraries. And the result is still better.

These are just words, but not supported by source code.

A widely used, simple benchmark with matrix multiplication is given just above. The texts of the programs in C++ and Pascal are given. The testing results under equal conditions give a speed difference of only 5%. Online, you can find publications that test algorithms in different programming languages systematically. For example, earlier I provided links to the work. Quote "We compared several programming languages ​​that are commonly used in biomedical research (S in the R implementation and Python) or that are optimized for speed (Swift, C++ and Object Pascal). In benchmarking experiments with two prototypical feedback loops, we found the implementations in Object Pascal to deliver the fastest results." The authors provide source codes that can be double-checked. My not very extensive experience (I started using FPC-Lazarus in 2022) in high-performance simulations when solving computational physics problems shows that FPC is a good, but underestimated tool.

JD

  • Hero Member
  • *****
  • Posts: 1905
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #147 on: May 11, 2025, 08:39:43 am »
Not completely sure but I think MS Visual Studio is written mostly in C# and unless you have a _really fast_ machine, it is barely usable.  It is barely usable on a 2.8Ghz machine.  When code doesn't run well on a 2.8Ghz, my opinion of it is "rather low".    I know because I use it and I have a 2.8 Ghz machine which I have no intention of upgrading because it's more than fast enough to execute the code I write in the blink of an eye and, if my code runs fast on my box, it will be faster than water sliding on greased teflon on today's machines.

I also had the same experience with Visual Studio Community Edition 2009. I installed it because I needed it to compile C++ code. The IDE is very resource hungry on legacy machines. It is one of the reasons why I upgraded all my development machines to 16GB and higher.

And like you, I like to deliberately try my applications on legacy machines, knowing that if I get it right, the applications will be lightning fast on the newer machines.
« Last Edit: May 11, 2025, 09:01:49 am by JD »
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

JD

  • Hero Member
  • *****
  • Posts: 1905
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #148 on: May 11, 2025, 08:57:10 am »
All official support is now limited to a difficult to use mailing list and this forum which is great IF you don’t happen need support on a day when we are getting ddosed and don’t mind encounters with grouchy old men who might come to your thread to share their unsolicited off topic opinions about your code.

Trust me, I've seen the same thing on Stack Overflow. And what is even worse is your question can be locked or labeled irrelevant if the admins deem it to be so. I still have questions on Stack Overflow (not in Object Pascal language) that remain unanswered. That has NEVER happened on this forum.

Seven years ago I could not have imagined the official support on other platforms disappearing. Maybe seven years from now this forum will be gone as well. Who knows. Things people need just tend to disappear...

Maybe not. I've seen a slight uptick in new users from Brazil and Argentina who came in from the Delphi community. They are migrating their tools to Lazarus/FPC and uploading videos on YouTube albeit in Portuguese and Spanish. In addition, there also seems to be some researchers that, maybe for nostalgic reasons or maybe just to compare its performance with other tools, have adopted Lazarus /FPC.

That said, I do agree with you that the community is shrinking, but you can still get help online. You just need to look, and this forum is a good place to start. You should also bookmark the Blaise Pascal Magazine website https://www.blaisepascalmagazine.eu. They organize physical events and workshops from time to time that you can attend if you so desire.

Cheers :D

JD
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

JD

  • Hero Member
  • *****
  • Posts: 1905
Re: Why isn't Lazarus / Free Pascal more popular?
« Reply #149 on: May 11, 2025, 09:03:49 am »
For example, earlier I provided links to the work. Quote "We compared several programming languages ​​that are commonly used in biomedical research (S in the R implementation and Python) or that are optimized for speed (Swift, C++ and Object Pascal). In benchmarking experiments with two prototypical feedback loops, we found the implementations in Object Pascal to deliver the fastest results." The authors provide source codes that can be double-checked.

@LV Can you please provide the links again? I would like to check them out.

Thanks,

JD
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

 

TinyPortal © 2005-2018