Recent

Author Topic: What is the FASTEST Computer Language? 45 Languages Tested!  (Read 32179 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #15 on: July 31, 2021, 07:50:11 pm »
This 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #16 on: July 31, 2021, 08:01:11 pm »
This 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][+][-]
  1. $ 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.
« Last Edit: July 31, 2021, 08:02:46 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #17 on: July 31, 2021, 10:05:12 pm »
So 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Kays

  • Hero Member
  • *****
  • Posts: 569
  • Whasup!?
    • KaiBurghardt.de
Re: What is the FASTEST Human Language? 45 Languages Tested!
« Reply #18 on: July 31, 2021, 10:17:56 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 line
Code: Bash  [Select][+][-]
  1. # Allow goto, inline, C-operators, C-vars
  2. -Sgic

[…] 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:
COperators 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.
Yours Sincerely
Kai Burghardt

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: What is the FASTEST Human Language? 45 Languages Tested!
« Reply #19 on: July 31, 2021, 10:31:22 pm »
No. Confer another thread on C-style assignments from earlier this month:
COperators 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #20 on: August 01, 2021, 12:22:25 am »
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
« Last Edit: August 01, 2021, 12:25:11 am by winni »

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: What is the FASTEST Human Language? 45 Languages Tested!
« Reply #21 on: August 01, 2021, 12:38:49 am »
By 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][+][-]
  1. # Allow goto, inline, C-operators, C-vars
  2. -Sgic

Thanks for the tip.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #22 on: August 01, 2021, 12:32:42 pm »
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.

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.

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.

C operators are enabled by default in the default configuration file.

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

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

  • Hero Member
  • *****
  • Posts: 6647
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #23 on: August 01, 2021, 03:18:39 pm »
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.

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][+][-]
  1. program GMP_Demo;
  2.  
  3. uses
  4.   math, gmp;
  5.  
  6. var
  7.   a:   mpz_t;
  8.   out: pchar;
  9.   len: longint;
  10.   i:   longint;
  11.  
  12. begin
  13.   mpz_init_set_ui(a, 5);
  14.   mpz_pow_ui(a, a, 4 ** (3 ** 2));
  15.   len := mpz_sizeinbase(a, 10);
  16.   writeln('GMP says size is: ', len);
  17.   out := mpz_get_str(NIL, 10, a);
  18.   writeln('Actual size is:   ', length(out));
  19.   write('Digits: ');
  20.   for i := 0 to 19 do
  21.     write(out[i]);
  22.   write ('...');
  23.   for i := len - 20 to len do
  24.     write(out[i]);
  25.   writeln;
  26. end.
  27.  
  28. ~$ time ./GMP_Demo
  29. GMP says size is: 183231
  30. Actual size is:   183231
  31. Digits: 62060698786608744707...92256259918212890625
  32.  
  33. real    0m0.032s
  34. user    0m0.027s
  35. sys     0m0.004s
  36.  

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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #24 on: August 03, 2021, 03:23:20 pm »
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #25 on: August 03, 2021, 04:04:00 pm »
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

  • Hero Member
  • *****
  • Posts: 6647
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #26 on: August 03, 2021, 04:53:37 pm »
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.

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.

Quote
Note 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #27 on: August 03, 2021, 05:13:56 pm »
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.

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

  • Full Member
  • ***
  • Posts: 177
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #28 on: August 13, 2021, 06:25:02 pm »
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

  • Full Member
  • ***
  • Posts: 242
Re: What is the FASTEST Computer Language? 45 Languages Tested!
« Reply #29 on: August 13, 2021, 10:52:15 pm »
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
 :P :D

SO NO site nor benchmurk are impartial and never will be. conjectures are kings of nonsense right?
« Last Edit: August 13, 2021, 11:05:10 pm by mercurhyo »
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

 

TinyPortal © 2005-2018