What is the FASTEST Computer Language? 45 Languages Tested! lazarus / 21-General ---------------------------------------------------------------------- WayneSherman · 2021-07-09 17:34 If you are a speed geek, you will probably be interested in this. What is the FASTEST Computer Language? 45 Languages Tested! (E01) https://www.youtube.com/watch?v=tQtFdsEcK_s Current standings at the time of this video Iterations per second: Ada:  67 Pascal: 143 Fastest language: 7301 Slowest language: 1 "HD Episode 01: Retired Microsoft engineer Dave Plummer takes you on a guided tour of 45 different computer languages and drag races each against one another using a prime sieve benchmark.  From Ada to Zig and everything in between, find out which is fastest and which is slowest." Github:  https://github.com/PlummersSoftwareLLC/Primes Current Pascal code:  https://github.com/PlummersSoftwareLLC/Primes/tree/drag- race/PrimePascal/solution_1 Current Delphi code:  https://github.com/PlummersSoftwareLLC/Primes/tree/drag- race/PrimeDelphi/solution_1 Pull requests for faster/better implementations: https://github.com/PlummersSoftwareLLC/Primes/pulls Related: https://components4developers.blog/2021/07/04/delphi-sieve-candidates- to-the-fastest-programming-language-contest/ ---------------------------------------------------------------------- Martin_fr · 2021-07-09 17:49 Oh no, not again... We had this topic before. At best it compares compilers. Not languages. ---------------------------------------------------------------------- MarkMLl · 2021-07-09 18:07 Oh FFS! The sieve benchmark was discredited in the mid-80s, because many compilers recognised the computations involved and shortcircuited the computation. MarkMLl ---------------------------------------------------------------------- alpine · 2021-07-09 19:10 IMHO, the video and the related GitHub project have a slightly different purpose and the title is misleading. They are rather a lecture on different programming languages. Just look at it all and you will understand what it is about. Not bad at overall. ---------------------------------------------------------------------- MarkMLl · 2021-07-09 21:29 Quote from: y.ivanov on July 09, 2021, 09:10:13 pmIMHO, the video and the related GitHub project have a slightly different purpose and the title is misleading. They are rather a lecture on different programming languages. Just look at it all and you will understand what it is about. Not bad at overall. In that case please consider my imprecation to be directed at OP who seemed to think that the numbers were significant. In actual fact I agree that some /languages/ might be slower than others and that it's not just an implementation issue. However a lot depends on whether the programmer insists on using facilities which break all possible compiler optimisations and give the CPU's runtime branch prediction etc. problems. MarkMLl ---------------------------------------------------------------------- WayneSherman · 2021-07-09 23:19 Quote from: MarkMLl on July 09, 2021, 11:29:43 pmIn that case please consider my imprecation to be directed at OP who seemed to think that the numbers were significant. I did not come up with the title, nor did I comment on the performance numbers (which are from the first episode looking at Pascal, Delphi, and Ada).  In the video, Dave Plummer has a brief discussion of language history and features, and shows what code looks like in each language.  This thing started out as "Software Drag Racing: C++ vs C# vs Python - Which Will Win?" and appears to have taken on a life of its own. ---------------------------------------------------------------------- MarkMLl · 2021-07-31 08:56 Comparisons are odious, and benchmarks doubly so. However they can at the very least highlight a perception problem. I've occasionally taken a look at Seed7, which is Pascal-like but simplifies a number of concepts and increases the language flexibility enormously. Using the Montecarlo benchmark at http://seed7.sourceforge.net/benchmks/montecarlo.htm I get a runtime like Code: [Select]/usr/local/src/seed7$ s7c -O2 -oc3 sinx2area.s7 SEED7 COMPILER Version 3.1.510 Copyright (c) 1990-2021 Thomas Mertes Source: sinx2area.s7 Compiling the program ... Generating code ... after walk_const_list 740 declarations processed 219 optimizations done 277 evaluations done 14 range checks inserted 107 index checks inserted 96 overflow checks inserted Calling the C compiler ... gcc -w -O2 -ffunction-sections -fdata-sections -c tmp_sinx2area.s7.c 2>tmp_sinx2area.s7.cerrs >/dev/null Calling the linker ... gcc -Wl\,--strip-debug -Wl\,--gc-sections -o sinx2area.s7_exe tmp_sinx2area.s7.o /usr/local/src/seed7/seed7/bin/s7_data.a /usr/local/src/seed7/seed7/bin/seed7_05.a -lm -ldl 2>tmp_sinx2area.s7.lerrs >/dev/null /usr/local/src/seed7$ time ./sinx2area.s7_exe 0.8953136 real    0m0.627s user    0m0.622s sys     0m0.005s while with the comparable Pascal program Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program sinx2area; const  n= 10000000; var  x, y: double;  i: longint;  num: longint= 0; begin  Randomize;  for i := 0 to n - 1 do begin    x := 2.0 * Random();    y := Random();    if y < Sin(x * x) then      num += 1  end;  WriteLn(2.0 * num / n)end.  I get this with different levels of optimisation: Code: [Select]/usr/local/src/seed7$ fpc sinx2area.pas Free Pascal Compiler version 3.2.0 [2020/11/20] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling sinx2area.pas Linking sinx2area 20 lines compiled, 0.2 sec /usr/local/src/seed7$ time ./sinx2area  8.952804208E-01 real    0m1.026s user    0m1.025s sys     0m0.000s /usr/local/src/seed7$ fpc -O1 sinx2area.pas Free Pascal Compiler version 3.2.0 [2020/11/20] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling sinx2area.pas Linking sinx2area 20 lines compiled, 0.2 sec /usr/local/src/seed7$ time ./sinx2area  8.946775794E-01 real    0m1.064s user    0m1.013s sys     0m0.000s /usr/local/src/seed7$ fpc -O2 sinx2area.pas Free Pascal Compiler version 3.2.0 [2020/11/20] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling sinx2area.pas Linking sinx2area 20 lines compiled, 0.2 sec /usr/local/src/seed7$ time ./sinx2area  8.946207762E-01 real    0m1.094s user    0m1.090s sys     0m0.001s /usr/local/src/seed7$ fpc -O3 sinx2area.pas Free Pascal Compiler version 3.2.0 [2020/11/20] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling sinx2area.pas Linking sinx2area 20 lines compiled, 0.2 sec /usr/local/src/seed7$ time ./sinx2area  8.946905732E-01 real    0m1.087s user    0m1.079s sys     0m0.004s /usr/local/src/seed7$ fpc -O4 sinx2area.pas Free Pascal Compiler version 3.2.0 [2020/11/20] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling sinx2area.pas Linking sinx2area 20 lines compiled, 0.3 sec /usr/local/src/seed7$ time ./sinx2area  8.948547840E-01 real    0m1.067s user    0m1.067s sys     0m0.001s Now I am sure that somebody will point out that there are compiler directives or command-line options that will speed that up, but that's hardly the point. Here we have two languages, of comparable functionality, and in terms of performance FPC is perceived as inferior. MarkMLl ---------------------------------------------------------------------- fcu · 2021-07-31 10:11 something i've experienced with fpc but didn't know how to report it i've done alots of benchmarks with defernet levels of optimization (-O1..4), the weird thig is all gives the same result  while on other compilers like gcc / vc you'll find for example -O3 produce much faster code than -O1 ---------------------------------------------------------------------- marcov · 2021-07-31 13:14 Old rule of thumb is that benchmarks that have a small amount of code in a single source file are pointless for the general case. They might model e.g. codecs or other very localized code, but hardly sizeable applications. ---------------------------------------------------------------------- Blade · 2021-07-31 15:32 Quote from: WayneSherman on July 09, 2021, 07:34:11 pmIf you are a speed geek, you will probably be interested in this. What is the FASTEST Computer Language? 45 Languages Tested! (E01) Not interested, and from the start knew it was purposely being deceptive.  I've seen various speed comparisons over the years, and the core behind them is usually a person or group trying to push their pet language(s).  The main trick is to have code optimized for a particular test.  Limit the test to something your pet language and/or compiler does well with.  Of course you come out on or near the top or you bash rival languages that seemingly don't do so well on the specifically preselected test and criteria.  Feign ignorance or completely gaslight whenever rival skilled programmers call the person out on the how and why of their test and criteria selection.  The key is to trick as many newbies, less knowledgeable people, and members of the media as possible before shutting down and declaring victory.  Let's not forget the trick of click-baiting for views as well.  If you are lucky, your propaganda will be regurgitated and circulated on the internet through 3rd parties for years. Add to the stinky game, which can be played against various languages, the additional agenda to bash Pascal by rival programming languages.  Usually because they don't like non C family languages or they have a corporate agenda in play. When a person talks about the speed of their language, the push back should be for what purpose?  Speed is always relative to what you are doing and your needs.  In fact, on the list of reasons why you are using a particular language for a specific purpose, speed might be several spots removed from the top of the list.  A lot depends on what you are doing. ---------------------------------------------------------------------- MarkMLl · 2021-07-31 16:12 Quote from: marcov on July 31, 2021, 03:14:41 pmOld rule of thumb is that benchmarks that have a small amount of code in a single source file are pointless for the general case. They might model e.g. codecs or other very localized code, but hardly sizeable applications. Undoubtedly. But we're not talking about a mere couple of percent here, and with the demise of Delphi as a standard bearer this is enough to affect the perception of Pascal as a whole. MarkMLl ---------------------------------------------------------------------- BobDog · 2021-07-31 16:53 Quote from: MarkMLl on July 31, 2021, 10:56:41 amComparisons are odious, and benchmarks doubly so. However they can at the very least highlight a perception problem. . . . . . . while with the comparable Pascal program Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program sinx2area; const  n= 10000000; var  x, y: double;  i: longint;  num: longint= 0; begin  Randomize;  for i := 0 to n - 1 do begin    x := 2.0 * Random();    y := Random();    if y < Sin(x * x) then      num += 1  end;  WriteLn(2.0 * num / n)end.  with version 3.2.2 (and 3.2.0) num+=1 is not allowed. You should use num:=num+1; perhaps there is a switch to enable +=, but you have not provided it. ---------------------------------------------------------------------- marcov · 2021-07-31 17:05 Quote from: MarkMLl on July 31, 2021, 06:12:28 pmUndoubtedly. But we're not talking about a mere couple of percent here, and with the demise of Delphi as a standard bearer this is enough to affect the perception of Pascal as a whole. IMHO you are fanning that wrong perception by creating dramatic threads about it. Don't adopt their narrative, but create an own narrative that is suitable to Pascal. Show apps and producitivty. ---------------------------------------------------------------------- Fred vS · 2021-07-31 17:31 Quote from: BobDog on July 31, 2021, 06:53:29 pmQuote from: MarkMLl on July 31, 2021, 10:56:41 amComparisons are odious, and benchmarks doubly so. However they can at the very least highlight a perception problem. . . . . . . while with the comparable Pascal program Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program sinx2area; const  n= 10000000; var  x, y: double;  i: longint;  num: longint= 0; begin  Randomize;  for i := 0 to n - 1 do begin    x := 2.0 * Random();    y := Random();    if y < Sin(x * x) then      num += 1  end;  WriteLn(2.0 * num / n)end.  with version 3.2.2 (and 3.2.0) num+=1 is not allowed. You should use num:=num+1; perhaps there is a switch to enable +=, but you have not provided it. Hello. This needs mode objfpc or objdelphi to work. Just add this at begin (or compile with -Mobjfpc). Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program sinx2area;{$mode objfpc}{$H+}... ---------------------------------------------------------------------- lucamar · 2021-07-31 17:46 Quote from: Fred vS on July 31, 2021, 07:31:41 pmThis needs mode objfpc or objdelphi to work. Or passing -Sc option to the compiler. ---------------------------------------------------------------------- MarkMLl · 2021-07-31 17:50 Quote from: lucamar on July 31, 2021, 07:46:02 pmQuote from: Fred vS on July 31, 2021, 07:31:41 pmThis needs mode objfpc or objdelphi to work. Or passing -Sc option to the compiler. That's strange, since the program as I gave it didn't originally need anything like that... and I did supply the commandlines etc. that I was using. Does 3.2 change the default? MarkMLl ---------------------------------------------------------------------- Fred vS · 2021-07-31 18:01 Quote from: MarkMLl on July 31, 2021, 07:50:11 pmQuote from: lucamar on July 31, 2021, 07:46:02 pmQuote from: Fred vS on July 31, 2021, 07:31:41 pmThis needs mode objfpc or objdelphi to work. Or passing -Sc option to the compiler. That's strange, since the program as I gave it didn't originally need anything like that... and I did supply the commandlines etc. that I was using. Does 3.2 change the default? MarkMLl Huh, I just tested your program without change and compile it with fpc 3.2.0.: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ fpc sinx2area.pas  and indeed it compiles without problems. So sorry for my post, it is not relevant. @ BobDog, here on Linux 64 with fpc 3.2.0 it works without any change. ---------------------------------------------------------------------- MarkMLl · 2021-07-31 20:05 Quote from: Fred vS on July 31, 2021, 08:01:11 pmSo sorry for my post, it is not relevant. @ BobDog, here on Linux 64 with fpc 3.2.0 it works without any change. No apology needed from you, I assure you. MarkMLl ---------------------------------------------------------------------- Kays · 2021-07-31 20:17 Quote from: BobDog on July 31, 2021, 06:53:29 pm[…] with version 3.2.2 (and 3.2.0) num+=1 is not allowed. You should use num:=num+1; perhaps there is a switch to enable +=, but you have not provided it.Yes, there is a compiler switch called {$cOperators}. By default it’s off, but in the standard fpc.cfg(5) located at /etc/fpc.cfg there is a lineCode: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i # Allow goto, inline, C-operators, C-vars-Sgic Quote from: MarkMLl on July 31, 2021, 07:50:11 pmQuote from: lucamar on July 31, 2021, 07:46:02 pm[…] Or passing -Sc option to the compiler.That's strange, since the program as I gave it didn't originally need anything like that... and I did supply the commandlines etc. that I was using. Does 3.2 change the default? […]No. Confer another thread on C-style assignments from earlier this month:Quote from: PascalDragon on July 13, 2021, 09:55:53 amCOperators Off is the default as far as the compiler is concerned. The fpc.cfg includes the -Sc. Also this will not change due to backwards compatibility. ---------------------------------------------------------------------- MarkMLl · 2021-07-31 20:31 Quote from: Kays on July 31, 2021, 10:17:56 pmNo. Confer another thread on C-style assignments from earlier this month:Quote from: PascalDragon on July 13, 2021, 09:55:53 amCOperators Off is the default as far as the compiler is concerned. The fpc.cfg includes the -Sc. Also this will not change due to backwards compatibility. Definitely something that I've not changed in my fpc.cfg, but it was originally created in 2015 so the installation default might have changed since then. MarkMLl ---------------------------------------------------------------------- winni · 2021-07-31 22:22 Hi! In the deep jungle of my backups I found: fpc 2.4.2:   -Sc off by default in fpc.cfg fpc 2.6.0:   -Sc off by default in fpc.cfg Winni PS: Both 2012 ---------------------------------------------------------------------- Fred vS · 2021-07-31 22:38 Quote from: Kays on July 31, 2021, 10:17:56 pmBy default it’s off, but in the standard fpc.cfg(5) located at /etc/fpc.cfg there is a line: Ha, ok, indeed, in my fpc.cfg there is: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i # Allow goto, inline, C-operators, C-vars-Sgic Thanks for the tip. Fre;D ---------------------------------------------------------------------- PascalDragon · 2021-08-01 10:32 Quote from: MarkMLl on July 31, 2021, 10:56:41 amNow I am sure that somebody will point out that there are compiler directives or command- line options that will speed that up, but that's hardly the point. Here we have two languages, of comparable functionality, and in terms of performance FPC is perceived as inferior. And do they document which PRNG they use? FPC's Random is documented to be a Mersenne Twister (though the generated sequence is not guaranteed to be that of a raw MT) and MTs are known to be on the slower side of things. So maybe right here you're comparing the performance of one PRNG to another instead of compiler A to compiler B. Quote from: BobDog on July 31, 2021, 06:53:29 pmwith version 3.2.2 (and 3.2.0) num+=1 is not allowed. You should use num:=num+1; perhaps there is a switch to enable +=, but you have not provided it. C operators are enabled by default in the default configuration file. Quote from: fcu on July 31, 2021, 12:11:03 pmsomething i've experienced with fpc but didn't know how to report it i've done alots of benchmarks with defernet levels of optimization (-O1..4), the weird thig is all gives the same result  while on other compilers like gcc / vc you'll find for example -O3 produce much faster code than -O1 Development of optimizations is a work-in-progress. Also in general only code will benifit that does fit the corresponding optimization requirements (e.g. global variables will never benefit from regvar optimizations, cause global variables are by definition volatile). ---------------------------------------------------------------------- MarkMLl · 2021-08-01 13:18 Quote from: PascalDragon on August 01, 2021, 12:32:42 pmAnd do they document which PRNG they use? FPC's Random is documented to be a Mersenne Twister (though the generated sequence is not guaranteed to be that of a raw MT) and MTs are known to be on the slower side of things. So maybe right here you're comparing the performance of one PRNG to another instead of compiler A to compiler B. Absolutely fair observation. As it happens I found an example on the Rosetta Code website yesterday evening which has variants for both Pascal and Seed7: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program GMP_Demo; uses  math, gmp; var  a:   mpz_t;  out: pchar;  len: longint;  i:   longint; begin  mpz_init_set_ui(a, 5);  mpz_pow_ui(a, a, 4 ** (3 ** 2));  len := mpz_sizeinbase(a, 10);  writeln('GMP says size is: ', len);  out := mpz_get_str(NIL, 10, a);  writeln('Actual size is:   ', length(out));  write('Digits: ');  for i := 0 to 19 do  write(out[i]);  write ('...');  for i := len - 20 to len do    write(out[i]);  writeln;end. ~$ time ./GMP_DemoGMP says size is: 183231Actual size is:   183231Digits: 62060698786608744707...92256259918212890625 real    0m0.032suser    0m0.027ssys     0m0.004s  Code: [Select]$ include "seed7_05.s7i";   include "bigint.s7i"; const proc: main is func   local     var bigInteger: fiveToThePowerOf262144 is 5_ ** 4 ** 3 ** 2;     var string: numberAsString is str(fiveToThePowerOf262144);   begin     writeln("5**4**3**2 = " <& numberAsString[..20] <&             "..." <& numberAsString[length(numberAsString) - 19 ..]);     writeln("decimal digits: " <& length(numberAsString));   end func; ~$ time ./GMP_Demo.s7_exe 5**4**3**2 = 62060698786608744707...92256259918212890625 decimal digits: 183231 real    0m0.003s user    0m0.000s sys     0m0.004s I don't, unfortunately, have time to go hunting for or transcribing larger programs to see how they behave. However- and please understand that I'm not trying to be negative here, just concerned- I feel that the fact that there appears to be such a difference in underlying performance is something that can't be evaded by saying "but look at all the great stuff that we've built on top of it!". MarkMLl ---------------------------------------------------------------------- MarkMLl · 2021-08-03 13:23 As an experiment, I've just written a little program which brute- forces the modular multiplicative inverse for a few million numbers, and find that it shows FPC in a far more favourable light (roughly 32 secs rather than Seed7's 50ish). In addition FPC was far easier to work with since its reporting of bad syntax was far more sensible, and by default it has more datatypes (e.g. Seed7 only supports 64-bit integers). So while I think that some of the other results might have been "interesting curios" and while the "cut-down-but-extensible" nature of Seed7 is definitely interesting, I happily apologise to anybody who thought I was being alarmist or spreading FUD. MarkMLl ---------------------------------------------------------------------- marcov · 2021-08-03 14:04 I know seed from 10-15 years back when Mertens was a regular in comp.lang.misc. It was really the meta programming and not fixating any rule for a language that seemed to be interesting to him. Note that the seed7 "compiler" compiles to C, so you are probably effectively comparing codegeneration to gcc. ---------------------------------------------------------------------- MarkMLl · 2021-08-03 14:53 Quote from: marcov on August 03, 2021, 04:04:00 pmI know seed from 10-15 years back when Mertens was a regular in comp.lang.misc. It was really the meta programming and not fixating any rule for a language that seemed to be interesting to him. Which interests me as well. One of the things I've found most difficult is getting sensible listings after the basic syntax has been augmented by imported modules... and then of course rolling back anything which should be strictly local. QuoteNote that the seed7 "compiler" compiles to C, so you are probably effectively comparing codegeneration to gcc. Yes. Hence I was wondering whether when GCC recompiled a program plus all imports it was managing to eliminate stackframes etc. to a far greater extent than FPC can manage with precompiled libraries and units. Obviously the separate compilation feature of FPC makes overall compilation far faster. MarkMLl ---------------------------------------------------------------------- marcov · 2021-08-03 15:13 Quote from: MarkMLl on August 03, 2021, 04:53:37 pmYes. Hence I was wondering whether when GCC recompiled a program plus all imports it was managing to eliminate stackframes etc. to a far greater extent than FPC can manage with precompiled libraries and units. GCC has much more elaborate LTO probably than FPC has, but I doubt that is enabled by default. It usually requires multiple compile passes. I think it can simply optimize a single file more. But as said, such one file math benchmarks are extremely atypical of normal programming. Most code calls non local functions/methods in most of its functions/methods. ---------------------------------------------------------------------- Blade · 2021-08-13 16:25 I'm surprised nobody has mentioned the website, benchmarksgame. https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html They have been claiming to show "Which programming language is fastest?", for years now.  At least they have a wider range of tests. ---------------------------------------------------------------------- mercurhyo · 2021-08-13 20:52 well let me laugh about speed. It only belongs to the "driver" on cars and on compilers. If someone is used to drive a ferrari this someone will push the limits of a skoda car if someone is used to drive a skoda this someone will never ever push the limits of a ferrari in compilers world it's exactly the same enjoy   SO NO site nor benchmurk are impartial and never will be. conjectures are kings of nonsense right? ---------------------------------------------------------------------- rsz · 2021-08-13 21:39 On the benchmarks game website, take a look at Free Pascal n-body vs GCC C++ n-body, the C++ one has manual SIMD intrinsics. Some benchmarks also compare single threaded to multi threaded. The results should not be taken at face value without reading the source of both programs, but I doubt anyone who is looking to decide on a language or looking for some quick numbers will actually read the source. ---------------------------------------------------------------------- mercurhyo · 2021-08-13 23:36 https://www.youtube.com/watch?v=HWpi9n2H3kE ALL compilers end to build machine code. so if the programmer knows machine code concepts and specific compiler tricks to achieve better machine code then ANY BENCHMURK is JUST CRAP and waste of time. this is true for DECADES.... any compiler no matter the language ---------------------------------------------------------------------- BeniBela · 2021-08-13 23:59 Or this: https://greenlab.di.uminho.pt/wp- content/uploads/2017/09/paperSLE.pdf Looks like all the fastest languages  have an LLVM version Even Intel just moved their compiler to LLVM. If Intel does not have the resources to maintain the optimizations necessary for a fast compiler, it is hopeless for FPC. If FPC wants to be the fastest language, the LLVM mode should be the default ---------------------------------------------------------------------- MathMan · 2021-08-14 11:39 Quote from: BeniBela on August 14, 2021, 01:59:50 amOr this: https://greenlab.di.uminho.pt/wp-content/uploads/2017/09/paperSLE.pdf Looks like all the fastest languages  have an LLVM version Even Intel just moved their compiler to LLVM. If Intel does not have the resources to maintain the optimizations necessary for a fast compiler, it is hopeless for FPC. If FPC wants to be the fastest language, the LLVM mode should be the default Hm, looking at table 5 of said report one could also come to the conclusion that Pascal is the second best language after C when considering the trinity of execution speed, memory and energy consumption. I couldn't identify the actual Pascal compiler used (but I only x-read the report) - however I do pass this result to the core dev team of Free Pascal with great respect. ---------------------------------------------------------------------- MarkMLl · 2021-08-14 12:00 Quote from: BeniBela on August 14, 2021, 01:59:50 amOr this: https://greenlab.di.uminho.pt/wp-content/uploads/2017/09/paperSLE.pdf Looks like all the fastest languages  have an LLVM version Even Intel just moved their compiler to LLVM. If Intel does not have the resources to maintain the optimizations necessary for a fast compiler, it is hopeless for FPC. If FPC wants to be the fastest language, the LLVM mode should be the default What is the LLVM overhead in terms of files etc.? At present an FPC compiler is defined by a single file in (e.g.) /usr/local/bin which knows where to find the associated backend files: I'm concerned that relying on LLVM might change that and it would risk an almighty mess of different LLVM versions and variants brought in by the basic OS and user-installed development tools. Apart from that, I believe that one of the core developers (Jonas?) highlighted an LLVM shortcoming a few weeks ago... possibly something to do with floating point exceptions? MarkMLl ---------------------------------------------------------------------- mercurhyo · 2021-08-14 18:21 Quote from: BeniBela on August 14, 2021, 01:59:50 amOr this: https://greenlab.di.uminho.pt/wp-content/uploads/2017/09/paperSLE.pdf Looks like all the fastest languages  have an LLVM version Even Intel just moved their compiler to LLVM. If Intel does not have the resources to maintain the optimizations necessary for a fast compiler, it is hopeless for FPC. If FPC wants to be the fastest language, the LLVM mode should be the default SMH your link is about energy....! Either you talk speed either yoou talk energy saving ... make your choice LOL inject 2L gas / 100km in a ferrari or 50L / 100km thats not the same problem at all cheers   what did you expect then? ferrari faster than bike? tooooo baaaaad ROFL ---------------------------------------------------------------------- Leledumbo · 2021-08-14 20:32 Quote from: BeniBela on August 14, 2021, 01:59:50 amIf FPC wants to be the fastest language, the LLVM mode should be the default Not something the core team will ever do, reading at this wiki article, even if they do admit on certain programs (that typically benchmarks focus on) LLVM does generate a faster code. ---------------------------------------------------------------------- Fred vS · 2021-08-14 20:46 Quote from: BeniBela on August 14, 2021, 01:59:50 amLooks like all the fastest languages  have an LLVM version. You are welcome to test-support-continue the already well advanced mselang project. Fre;D ---------------------------------------------------------------------- devEric69 · 2021-08-15 08:28 Hello @Fre;D, [off topic /on] I have a question about mseide-msegui. If I understand correctly, there are visual controls (of msegui) that are drawn by calls to X11 (like fpGUI). I know that fpGUI has an independent package (fpgui_ide.lpk) that I just need to be required in a Lazarus project in order to create an X11 application (I also know that you have written an IDE-designer in order to create X11 RAD forms). My question - general culture - is: is there a msegui package (*.lpk) that can be also required from a Lazarus project (really sorry, I'm just an application builder knowing nothing about compilers; no more time to disperse myself towards something else, different from Lazarus [^])? If so, are the msegui and fpGUI controls compatible, adaptable (in a same X-11 application, rather targeted at the base for a true graphic server having no desktop installed on it, AFAIK the boundary between Wayland and X11)? [^] just to understand how to turn around the --pcp in order to create an organisational pattern to put me back into the context of an old release (historised with SVN) and debug it, was a huge intellectual effort\challenge for me . [off topic /off] ---------------------------------------------------------------------- PascalDragon · 2021-08-15 11:27 Quote from: BeniBela on August 14, 2021, 01:59:50 amIf FPC wants to be the fastest language, the LLVM mode should be the default No one said that this is our goal. Yes, we want FPC to generate good, fast code, but speed is not everything. ---------------------------------------------------------------------- Seenkao · 2021-08-15 13:01 Quote from: BeniBela on August 14, 2021, 01:59:50 amIf FPC wants to be the fastest language, the LLVM mode should be the default Я не думаю, что это хорошая идея! Заглядывать и оптимизировать код - это да. Но менять одно на другое? Зачем? Что нельзя сделать, что уже сделано в LLVM? Я занимаюсь разработкой и постоянно смотрю код, который получаю в конце компиляции. Если мне не нравится этот код, я стараюсь его улучшить. Я понимаю, что определённый код меня не устроит. По сути, лучший код ни один компилятор вам не сделает. Но компилятор достаточно неплохо оптимизирован. И, вам не нужно оптимизировать каждую свою строчку кода, для улучшения конечного кода (по простой причине, что за вас многое уже сделали). Google translate: I do not think it's a good idea! Peeking in and optimizing the code is yes. But change one for the other? What for? What cannot be done, what has already been done in LLVM? I am doing development and constantly looking at the code that I get at the end of compilation. If I don't like this code, I try to improve it. I understand that a certain code will not suit me. In fact, no compiler will make the best code for you. But the compiler is quite well optimized. And, you don't need to optimize every line of your code to improve the final code (for the simple reason that a lot has already been done for you). To improve / speed up your code, you should watch code that is constantly being executed. If you can minimize / optimize it, then this will be the end result. You! And only YOU! The person who will be responsible for your code! The compiler will take your code and optimize as "taught" it. Knowing how the compiler works, you can also improve the performance of your program! Для улучшения/ускорения работы кода, вы должны смотреть код, который постоянно выполняется. Если вы его можете минимизировать/оптимизировать, то это и будет конечным результатом. Вы! И только ВЫ! Тот человек, который будет отвечать за ваш код! Компилятор примет ваш код и оптимизирует как его "учили". Зная работу компилятора, вы так же можете улучшить работу своей программы! ---------------------------------------------------------------------- Fred vS · 2021-08-15 13:15 [off topic /on] Quote from: devEric69 on August 15, 2021, 10:28:03 amHello @Fre;D, I have a question about mseide-msegui. If I understand correctly, there are visual controls (of msegui) that are drawn by calls to X11 (like fpGUI). Hello Eric. Correct.  Both fpGUI and MSEgui use direct call to X11 for Unix OS (Linux, FreeBSD and old XQuartz Mac OS), gdi for Windows. Quote from: devEric69 on March 01, 1975, 11:26:48 am  I know that fpGUI has an independent package (fpgui_ide.lpk) that I just need to be required in a Lazarus project in order to create an X11 application (I also know that you have written an IDE-designer in order to create X11 RAD forms). The fpgui_ide.lpk contain only the path of the source of fpGUI. It allows you to create also a Lazarus lpi project files compatible with fpGUI. But you still need to use the fpGUI form-designer, fpGUI is not compatible with Lazarus form designer (and his object-inspector). Quote from: devEric69 on August 15, 2021, 10:28:03 amMy question - general culture - is: is there a msegui package (*.lpk) that can be also required from a Lazarus project (really sorry, I'm just an application builder knowing nothing about compilers; no more time to disperse myself towards something else, different from Lazarus [^])? There is no msegui-lpk at the moment but if you use ideU, there is a prj to lpi converter. This will convert the mseide/ideU prj project into a lpi Lazarus project. So, like for fpGUI, you may use Lazarus ide and all feature of the code editor but the Lazarus form-designer/object inspector will not work, you will need to use the MSEide/ideU form-designer/object inspector. Quote from: devEric69 on August 15, 2021, 10:28:03 am If so, are the msegui and fpGUI controls compatible, adaptable (in a same X-11 application, rather targeted at the base for a true graphic server having no desktop installed on it, AFAIK the boundary between Wayland and X11)? fpGUI and MSEgui are two different project.  Their components are not compatible (but they use the same X11 pascal header to access the X11 libraries). Andrew Haines translated Wayland-headers for fpc: https://github.com/andrewd207/fpc-wayland He did also the interface Wayland/fpGUI but this is not yet totally working well. Of course this could be used later for MSEgui too. Also Graeme said that he will do a interface Mac-Cocoa/fpGUI (but it seems that he forgot it  ). Fre;D [off topic /off] ---------------------------------------------------------------------- Fred vS · 2021-08-15 13:33 Quote from: PascalDragon on August 15, 2021, 01:27:45 pmQuote from: BeniBela on August 14, 2021, 01:59:50 amIf FPC wants to be the fastest language, the LLVM mode should be the default No one said that this is our goal. Yes, we want FPC to generate good, fast code, but speed is not everything. If fpc could optimize speed of float calculation and approach the speed of LLVM it would be great. Fre;D ---------------------------------------------------------------------- devEric69 · 2021-08-15 18:57 [off topic /on] @Fred, thank you very much for the time taken for your clarifications between fpGUI and MSEgui (I guess that only the way of drawing the controls is common; the main message loop - depending on the type of application - and their messages must be incompatible). [off topic /off] ---------------------------------------------------------------------- Mr.Madguy · 2021-08-22 14:56 Quote from: MarkMLl on July 31, 2021, 10:56:41 amComparisons are odious, and benchmarks doubly so. However they can at the very least highlight a perception problem. I've occasionally taken a look at Seed7, which is Pascal-like but simplifies a number of concepts and increases the language flexibility enormously. Using the Montecarlo benchmark at http://seed7.sourceforge.net/benchmks/montecarlo.htm I get a runtime like Interesting idea. I also had such idea, when wanted to implement closures by myself. They're just syntax sugar around interfaces, so they should be easy to implement. But I don't have enough experience with FPC sources to do everything right and not brake anything. And then I realized, that it would be great to have extendable syntax. Even whole language could be build from scratch around compile-time extendable syntax. I would call it MetaPascal. ---------------------------------------------------------------------- MarkMLl · 2021-08-22 15:36 Quote from: Mr.Madguy on August 22, 2021, 04:56:23 pmInteresting idea. I also had such idea, when wanted to implement closures by myself. They're just syntax sugar around interfaces, so they should be easy to implement. But I don't have enough experience with FPC sources to do everything right and not brake anything. And then I realized, that it would be great to have extendable syntax. Even whole language could be build from scratch around compile-time extendable syntax. I would call it MetaPascal. I think quite a lot could be done by going back to a fairly austere ALGOL-like base, with a design dogma that under no circumstances should types be promoted implicitly. On top of that allow explicit definition of operators and functions, and have traits associated with types indicating which operations could be inherited by subtypes, which needed to be redefined and so on. However I think a serious stumbling block is the behaviour when a stack frame is unwound on function exit. Modern languages assume at least that there is a hook here which e.g. allows dynamically- allocated local strings to be freed and any exception state to be unwound, but it complicates explicit exit/return handling (i.e. as distinct from simply falling out of the end of the function) and has the potential to be a resource hog if units can be precompiled separately. I suspect that precompilation also implicitly complicates template/generic handling, and it's interesting that Stallman once looked at a language (Pastel) which allowed parametric types but found that this required that the entire program's abstract syntax tree be held in memory which was out of the question for the microprocessor- based computers of the day. MarkMLl ---------------------------------------------------------------------- Mr.Madguy · 2021-08-23 11:15 All I need - is to replace this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  TIterator = reference to function:Integer; var  Iterator:TIterator; function CreateIterator:TClosure;  var I:Integer;begin  I := 0;  Result := function:Integer  begin    Result := I;    Inc(I);  end;end; Iterator := CreateIterator; WriteLn(Iterator); with this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  IIteratorInterface = interface;   TIteratorMethod1 = function(Self:IIteratorInterface):Integer;    IIteratorInterface = interface    function IteratorMethod1:Integer;  end;   TIterator = record    Method:TIteratorMethod1;    Interface:IIteratorInterface;  end;   TIteratorClass = Class(TInterfacedObject, IIteratorInterface)  I:Integer;    function IteratorMethod1:Integer;  end; var  Iterator:TIterator; function TIteratorClass.IteratorMethod1:Integer;begin  Result := I;  Inc(I);end; function CreateIterator:TIterator;  var IteratorVar:TIteratorClass;begin   IteratorVar := TIteratorClass.Create;   IteratorVar.I := 0;   Result.Method := @IteratorVar.IteratorMethod1;//I know, it's wrong   Result.Interface := IteratorVar;end; Iterator := CreateIterator; WriteLn(Iterator.Method(Iterator.Interface)); Now I need to learn how to change FPC sources for this. It would take too much time, would be too hard and counter-productive. But what if I would be able to add some Closures.pas unit to my project, where I would be able to describe closure extended syntax? It would be compiled to some sort of compiler runtime module, that would be able to handle closures at compile time. ---------------------------------------------------------------------- marcov · 2021-08-23 12:26 FPC does not implement anonymous methods yet.  It has been in the works for years by 3rd party devels, but somehow it doesn't get finished (or submitted) ---------------------------------------------------------------------- Mr.Madguy · 2021-08-23 13:38 Quote from: marcov on August 23, 2021, 02:26:44 pmFPC does not implement anonymous methods yet. It has been in the works for years by 3rd party devels, but somehow it doesn't get finished (or submitted) May be that's because they think, that it's hard to implement? It's just another way of defining classes, that doesn't require class definition itself and therefore saves many code lines. Overall whole closure structure is something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function ClosureContext:TClosureContainer;//Container - in case we want to have several closures  var , ;begin  Result.Closure1 := ;  Result.Closure2 := ;  Result.Closure3 := ;end; Turns into: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i IClosureInterface = interface       end; TClassImlementingClosures = class(TInterfacedObject, IClosureInterface)        end; So, it's just matter of turning one code into another code. That's why having extendable syntax would be great for this task. ---------------------------------------------------------------------- marcov · 2021-08-23 14:01 Quote from: Mr.Madguy on August 23, 2021, 03:38:03 pmQuote from: marcov on August 23, 2021, 02:26:44 pmFPC does not implement anonymous methods yet. It has been in the works for years by 3rd party devels, but somehow it doesn't get finished (or submitted) May be that's because they think, that it's hard to implement? It's just another way of defining classes, that doesn't require class definition itself It is primarily added for Delphi compatibility and there it is primarily used to schedule tasks in other threads.  But yes, it must dynamically capture state. (though that is horribly wonky in Delphi too, as it often captures references to state rather than the state itself). And it must all be memory safe in the end (though that builds on top of existing interfaces infra). Why it takes so long I don't know, and since there is little info to base speculation on. QuoteSo, it's just matter of turning one code into another code. That's why having extendable syntax would be great for this task. The syntax is already fixed by Delphi ---------------------------------------------------------------------- Seenkao · 2021-08-23 15:20 Quote from: Mr.Madguy on August 23, 2021, 01:15:31 pmAll I need - is to replace this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  TIterator = reference to function:Integer; var  Iterator:TIterator; function CreateIterator:TClosure;  var I:Integer;begin  I := 0;  Result := function:Integer  begin    Result := I;    Inc(I);  end;end; Iterator := CreateIterator; WriteLn(Iterator); with this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  IIteratorInterface = interface;   TIteratorMethod1 = function(Self:IIteratorInterface):Integer;    IIteratorInterface = interface    function IteratorMethod1:Integer;  end;   TIterator = record    Method:TIteratorMethod1;    Interface:IIteratorInterface;  end;   TIteratorClass = Class(TInterfacedObject, IIteratorInterface)  I:Integer;    function IteratorMethod1:Integer;  end; var  Iterator:TIterator; function TIteratorClass.IteratorMethod1:Integer;begin  Result := I;  Inc(I);end; function CreateIterator:TIterator;  var IteratorVar:TIteratorClass;begin   IteratorVar := TIteratorClass.Create;   IteratorVar.I := 0;   Result.Method := @IteratorVar.IteratorMethod1;//I know, it's wrong   Result.Interface := IteratorVar;end; Iterator := CreateIterator; WriteLn(Iterator.Method(Iterator.Interface)); Now I need to learn how to change FPC sources for this. It would take too much time, would be too hard and counter-productive. But what if I would be able to add some Closures.pas unit to my project, where I would be able to describe closure extended syntax? It would be compiled to some sort of compiler runtime module, that would be able to handle closures at compile time. Точнее, вы делаете больше работы, для того чтоб сделать больше работы в дальнейшем? Я смотрю на второй код, и вижу что он больше. Как при создании, так и при использовании. В чём преимущество второго кода? google translate: More specifically, are you doing more work to do more work in the future? I look at the second code and see that it is larger. Both in creation and in use. What is the advantage of the second code? ---------------------------------------------------------------------- Mr.Madguy · 2021-08-23 15:24 Quote from: marcov on August 23, 2021, 04:01:07 pmIt is primarily added for Delphi compatibility and there it is primarily used to schedule tasks in other threads.  But yes, it must dynamically capture state. (though that is horribly wonky in Delphi too, as it often captures references to state rather than the state itself). And it must all be memory safe in the end (though that builds on top of existing interfaces infra). Why it takes so long I don't know, and since there is little info to base speculation on. They're usable in any callbacks, that require state passing. While classes are data with code attached to them, closures are opposite - they're code with data attached to them. Test cases are implemented via closures in my project. There are thousands of them. It has taken many months to write this code. That's why their code should be kept as minimum, as possible. Rewriting this code using classes/interfaces would be massive job. But overall my goal is to fully migrate to Linux and get rid of Windows/Delphi dependency. I would want to help with it, but starting to dig into FPC sources from scratch - is too big thing for me and I really think, that it would be counter-productive. Example of using closures in my project: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure AddTests(ATestCase:TObjectContainerTestCase, TArray>;ASorted:Boolean);  var TestHelper:TAbstractTestHelper;begin  TestHelper := ATestCase.TestHelper;  with TestHelper do begin...    ATestCase.AddTestCase(      'Query test',      True,      function(var ASource:TAbstractList):TAbstractList      begin      Result := ASource.Query(TDelegatedPredicate.Create(        function(AValue:Integer):Boolean          begin            Result := AValue mod 2 = 0;          end        ));      end,      ArrayOfInteger([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),      ArrayOfInteger([2, 4, 6, 8, 10])    );...  end;end; Not 100% good example, because it doesn't show, that TestHelper methods or ASorted can be used inside callbacks, therefore it doesn't show all pros of using closures. One can argue, that above code can be implemented via static procedures. ---------------------------------------------------------------------- PascalDragon · 2021-08-26 13:03 Quote from: marcov on August 23, 2021, 04:01:07 pmWhy it takes so long I don't know, and since there is little info to base speculation on. The feature itself is feature-complete, the remaining part is reintegration into main and right now the provided code is essentially akin to a cancer. Before that is restructured I'm not going to integrate that. ---------------------------------------------------------------------- damieiro · 2021-08-26 20:44 pure assembly  Really any ALGOL 60 (68?) descendant would have the same speed potential. It would only be a compiler matter. C, Pascal, Ada, teoretically can achieve same speed. In certain (broad) way, C<->Pascal translation is nearly automatic. And even i would say that pascal should do even better speed because compiler has more information (strong typed, and things like that). On the other hand, it's difficult today thinking in a big app made with only one languaje. OS (platform) are in Cs* and even same compiler with same languaje (even C) could perform different from one OS to another... ---------------------------------------------------------------------- MarkMLl · 2021-08-27 06:25 Quote from: damieiro on August 26, 2021, 10:44:22 pmReally any ALGOL 60 (68?) descendant would have the same speed potential. It would only be a compiler matter. C, Pascal, Ada, teoretically can achieve same speed. I'm sorry, I disagree. As a specific example, a language which relies heavily on termination code at the end of every block to unwind temporary allocations and exception handlers will always be slower than one that doesn't provide that facility, and that is generally made worse if separate compilation prevents that from being optimised away (due to callbacks expecting the same stack layout). Apart from that, just about everything is derived from ALGOL these days. Classic FORTRAN and COBOL have (thankfully) withered as have environments such as Lisp, Prolog, Smalltalk and Forth, and their descendants are quick to point out how much they've borrowed from ALGOL/Pascal/Ada: control blocks, data structures and the rest. But some of those descendants couldn't be implemented without heavy use of either reference counting or garbage collection, and again those are inherent time-wasters. QuoteIn certain (broad) way, C<->Pascal translation is nearly automatic. And even i would say that pascal should do even better speed because compiler has more information (strong typed, and things like that). On the other hand, it's difficult today thinking in a big app made with only one languaje. OS (platform) are in Cs* and even same compiler with same languaje (even C) could perform different from one OS to another... I've had people in the past trying to convince me that UNIX-based systems could /only/ be programmed in C. MarkMLl ---------------------------------------------------------------------- damieiro · 2021-08-27 09:02 Quote'm sorry, I disagree. As a specific example, a language which relies heavily on termination code at the end of every block to unwind temporary allocations and exception handlers will always be slower than one that doesn't provide that facility, and that is generally made worse if separate compilation prevents that from being optimised away (due to callbacks expecting the same stack layout). Apart from that, just about everything is derived from ALGOL these days. Classic FORTRAN and COBOL have (thankfully) withered as have environments such as Lisp, Prolog, Smalltalk and Forth, and their descendants are quick to point out how much they've borrowed from ALGOL/Pascal/Ada: control blocks, data structures and the rest. But some of those descendants couldn't be implemented without heavy use of either reference counting or garbage collection, and again those are inherent time-wasters. Well, nothing to say, your point is valid, i agree. I was thinking more on c/pascal/ada tree of algol68. QuoteI've had people in the past trying to convince me that UNIX-based systems could /only/ be programmed in C. I've thinking a lot of times that i would love that history will make pascal - again- used as OS languaje. Any knows if there is being tried a OS coded in pascal or something like that?. It would be funny repeating the story of Linus Torvalds redoing kernel in FreePascal. Sometimes i have thought (but i have no time) of making a mini OS made only in pascal as a start point for doing something bigger. Dreams... ---------------------------------------------------------------------- MarkMLl · 2021-08-27 09:10 Quote from: damieiro on August 27, 2021, 11:02:43 amWell, nothing to say, your point is valid, i agree. I was thinking more on c/pascal/ada tree of algol68. But FPC does have arbitrary unwind code at the end of functions and procedures, which is how locally-defined strings and dynamic arrays are freed. QuoteI've thinking a lot of times that i would love that history will make pascal - again- used as OS languaje. Any knows if there is being tried a OS coded in pascal or something like that?. It would be funny repeating the story of Linus Torvalds redoing kernel in FreePascal. Sometimes i have thought (but i have no time) of making a mini OS made only in pascal as a start point for doing something bigger. Dreams... Yes, there've been many: as a specific example, Cray's OSes were coded in Pascal (although the anti-Pascal purists would attempt to save face by saying that because it was enhanced beyond the standard definitions it wasn't really Pascal). I've used Modula-2 for a microkernel plus network etc. BUT robust type checking becomes a problem as soon as you're passing variable-sized packets around which negates a lot of Pascal's advantage. MarkMLl ---------------------------------------------------------------------- damieiro · 2021-08-27 09:38 QuoteYes, there've been many: as a specific example, Cray's OSes were coded in Pascal (although the anti-Pascal purists would attempt to save face by saying that because it was enhanced beyond the standard definitions it wasn't really Pascal). I've used Modula-2 for a microkernel plus network etc. I would search for these (itches my curiosity). Are there modern ones?. Quote BUT robust type checking becomes a problem as soon as you're passing variable-sized packets around which negates a lot of Pascal's advantage.I don't know why. Even in the worst case one can take these as raw data, have fun with pointers and then process that like a C code. Well, i'm talking lightly without seeing the real problem. In worst scenario one will be like C and a nice reading code ---------------------------------------------------------------------- MarkMLl · 2021-08-27 09:48 Quote from: damieiro on August 27, 2021, 11:38:59 amQuoteYes, there've been many: as a specific example, Cray's OSes were coded in Pascal (although the anti-Pascal purists would attempt to save face by saying that because it was enhanced beyond the standard definitions it wasn't really Pascal). I've used Modula-2 for a microkernel plus network etc. I would search for these (itches my curiosity). Are there modern ones?. Most of the Cray engineering documentation and sources was destroyed: SGI had a beach bonfire party when they bought them. People like Chris Fenton have had some success scraping stuff together from old disk packs. As far as modern work is concerned, the thing that springs to mind is Oberon. There's also a modern Pascal-based stand-alone project for the Raspberry Pi although the name escapes me and I don't know how heavily it relies on assembler. Unfortunately, most people these days think that "writing an operating system in XXXX" means yet another GUI built on top of Windows or Linux. QuoteQuote BUT robust type checking becomes a problem as soon as you're passing variable-sized packets around which negates a lot of Pascal's advantage.I don't know why. Even in the worst case one can take these as raw data, have fun with pointers and then process that like a C code. Well, i'm talking lightly without seeing the real problem. In worst scenario one will be like C and a nice reading code But the last thing you want if considering a robust language is to be passing pointers around without the compiler having the opportunity to check and enforce the size of the associated data... which is exactly what you get with stream-based protocols like TCP. MarkMLl ---------------------------------------------------------------------- damieiro · 2021-08-27 12:49 Thanks MarkMLI I will see the http://www.projectoberon.com/home  i allways love read Wirth QuoteBut the last thing you want if considering a robust language is to be passing pointers around without the compiler having the opportunity to check and enforce the size of the associated data... which is exactly what you get with stream-based protocols like TCP. Yes, but i do not know a robust solution for this. Only say that FreePascal con do with same or better readibility than C and same performance. Designing a new protocol in...3..2..1.. ---------------------------------------------------------------------- MarkMLl · 2021-08-27 14:29 Quote from: damieiro on August 27, 2021, 02:49:50 pmThanks MarkMLI I will see the http://www.projectoberon.com/home  i allways love read Wirth QuoteBut the last thing you want if considering a robust language is to be passing pointers around without the compiler having the opportunity to check and enforce the size of the associated data... which is exactly what you get with stream-based protocols like TCP. Yes, but i do not know a robust solution for this. Only say that FreePascal con do with same or better readibility than C and same performance. Designing a new protocol in...3..2..1..  A moderately-robust solution is descriptor-based protected memory with fine granularity, in which case you can- in principle- pass descriptor references around as atomic operations and rely on the hardware checking for overruns. But that pitch has been queered by the grossly inadequate number of descriptors in the PM x86 architecture, which means that almost everybody dismisses it out of hand. MarkMLl