www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Language progress? [partially OT]

reply bearophile <bearophileHUGS lycos.com> writes:
Just a lazy note, don't take this too much seriously.

The Computer Language Benchmarks Game (Computer Shootout) has added some
Clojure implementations, they are not tuned and refined yet (probably unlike
the Free Pascal versions). This is one of the problems ("fasta"), there are two
Free Pascal and two Clojure implementations:

http://shootout.alioth.debian.org/u64q/performance.php?test=fasta&sort=kb

The Clojure versions currently use about 370_000 KB of RAM to run, their source
code is about 1_600 compressed bytes long, and their run time is about 30-38
seconds.

The Free Pascal versions use about 250 KB of RAM, their compressed source code
is about 1_100-1_200 bytes long, and their runtime is 8-12 seconds.

I have written many small programs in Scheme, but for me that Free Pascal code
is more readable than that Clojure code. Probably Free Pascal lacks some of the
cool new features of Clojure (including a garbage collector), but I don't see
much progress in languages development/hystory here ;-)


A question: Here for example the cheapest C program uses 452 KB of RAM. On
average in the Shootout benchmarks Free Pascal uses less or quite less RAM than
the D programs. Do you know why the Free Pascal programs use so little RAM?

Bye,
bearophile
Oct 22 2010
next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
bearophile wrote:
 A question: Here for example the cheapest C program uses 452 KB of RAM. On
 average in the Shootout benchmarks Free Pascal uses less or quite less RAM
 than the D programs. Do you know why the Free Pascal programs use so little
 RAM?
Pascal doesn't use GC.
Oct 22 2010
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Walter Bright:

 bearophile wrote:
 A question: Here for example the cheapest C program uses 452 KB of RAM. On
 average in the Shootout benchmarks Free Pascal uses less or quite less RAM
 than the D programs. Do you know why the Free Pascal programs use so little
 RAM?
Pascal doesn't use GC.
Sorry, I meant C there! My mistake! Bye, bearophile
Oct 22 2010
prev sibling parent Daniel Gibson <metalcaedes gmail.com> writes:
Walter Bright schrieb:
 bearophile wrote:
 A question: Here for example the cheapest C program uses 452 KB of 
 RAM. On average in the Shootout benchmarks Free Pascal uses less or quite less 
 RAM than the D programs. Do you know why the Free Pascal programs use so 
 little RAM?
Pascal doesn't use GC.
Neither does C
Oct 22 2010
prev sibling parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
I still have found memories of Pascal (actually Turbo Pascal/Delphi).

Not sure about FreePascal, but I remember Turbo Pascal used to have a better 
memory allocator
than C.

In the old days (Windows 3.x) the runtime memory manager has more optimized 
than the C compiler
family. Please note I am speaking about  Borland compilers here.

That not being the case, I would say that whoever implemented the algorithms 
in C is not as good as
the one who did them in Pascal. Or did not use the proper compiler flags.

--
Paulo


"bearophile" <bearophileHUGS lycos.com> wrote in message 
news:i9tio7$26dd$1 digitalmars.com...
 Just a lazy note, don't take this too much seriously.

 The Computer Language Benchmarks Game (Computer Shootout) has added some 
 Clojure implementations, they are not tuned and refined yet (probably 
 unlike the Free Pascal versions). This is one of the problems ("fasta"), 
 there are two Free Pascal and two Clojure implementations:

 http://shootout.alioth.debian.org/u64q/performance.php?test=fasta&sort=kb

 The Clojure versions currently use about 370_000 KB of RAM to run, their 
 source code is about 1_600 compressed bytes long, and their run time is 
 about 30-38 seconds.

 The Free Pascal versions use about 250 KB of RAM, their compressed source 
 code is about 1_100-1_200 bytes long, and their runtime is 8-12 seconds.

 I have written many small programs in Scheme, but for me that Free Pascal 
 code is more readable than that Clojure code. Probably Free Pascal lacks 
 some of the cool new features of Clojure (including a garbage collector), 
 but I don't see much progress in languages development/hystory here ;-)


 A question: Here for example the cheapest C program uses 452 KB of RAM. On 
 average in the Shootout benchmarks Free Pascal uses less or quite less RAM 
 than the D programs. Do you know why the Free Pascal programs use so 
 little RAM?

 Bye,
 bearophile 
Oct 22 2010
parent reply bearophile <bearophileHUGS lycos.com> writes:
Paulo Pinto:

 I would say that whoever implemented the algorithms 
 in C is not as good as
 the one who did them in Pascal. Or did not use the proper compiler flags.
I don't know the answer, but I think both those hypothesis are not substantiated by facts, because in the Shootout site the C compiler flags are chosen carefully (they are chosen for speed), while the C programs are probably written a bit better than the Free Pascal ones (Free Pascal uses ObjectPascal, it's a language quite far from the original Pascals). Maybe the Free Pascal compiler is just better than GCC regarding static/stack memory usage. Bye, bearophile
Oct 23 2010
parent reply retard <re tard.com.invalid> writes:
Sat, 23 Oct 2010 08:10:50 -0400, bearophile wrote:

 Paulo Pinto:
 
 I would say that whoever implemented the algorithms in C is not as good
 as
 the one who did them in Pascal. Or did not use the proper compiler
 flags.
I don't know the answer, but I think both those hypothesis are not substantiated by facts, because in the Shootout site the C compiler flags are chosen carefully (they are chosen for speed), while the C programs are probably written a bit better than the Free Pascal ones
 Maybe the Free Pascal compiler is just better than
 GCC regarding static/stack memory usage.
My guess is, Pascal enforces a coding style that tries to minimize resource use. For example all local variables need to be defined before statements. It also lacks many high level constructs, which might contain inefficiencies the programmer isn't aware of.
 (Free Pascal uses ObjectPascal, it's a language quite far from the
 original Pascals).
I can assure you that most commercial / hobbyist users of Pascal haven't used the original Pascal since Moses was born. The early Turbo Pascal already got units (1987) and object-oriented features [ == Object Pascal ] (1986 Mac, 1989 PC). Might be the case that you weren't even born when Object Pascal came.
Oct 23 2010
parent reply Walter Bright <newshound2 digitalmars.com> writes:
retard wrote:
 I can assure you that most commercial / hobbyist users of Pascal haven't 
 used the original Pascal since Moses was born.
I tried to use Pascal around 1979-1980. It's probably the most unusable language ever invented. Every commercial implementation of it had to have a boatload of extensions to make it work. The problem was, of course, every vendor implemented a different boatload.
Oct 23 2010
parent reply Russel Winder <russel russel.org.uk> writes:
On Sat, 2010-10-23 at 15:23 -0700, Walter Bright wrote:
 retard wrote:
 I can assure you that most commercial / hobbyist users of Pascal haven'=
t=20
 used the original Pascal since Moses was born.
=20 I tried to use Pascal around 1979-1980. It's probably the most unusable l=
anguage=20
 ever invented. Every commercial implementation of it had to have a boatlo=
ad of=20
 extensions to make it work.
=20
 The problem was, of course, every vendor implemented a different boatload=
. Pascal was never really intended as a production language, it was intended for teaching programming and the abstract concepts behind programming. I suggest that in the period 1972-82 it achieved its goals admirably. From 1984 onwards it was clearly becoming insufficient for the task and things moved on. Most of the commercial Pascal varieties tried to be variants on Modula-2 but labelled themselves Pascal, and here lie the real problems and the hassles that led to Pascal ending up with a bad name -- one it should not be landed with in perpituity.=20 --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Oct 23 2010
parent reply Walter Bright <newshound2 digitalmars.com> writes:
Russel Winder wrote:
 Pascal was never really intended as a production language, it was
 intended for teaching programming and the abstract concepts behind
 programming.  I suggest that in the period 1972-82 it achieved its goals
 admirably.  From 1984 onwards it was clearly becoming insufficient for
 the task and things moved on.
 
 Most of the commercial Pascal varieties tried to be variants on Modula-2
 but labelled themselves Pascal, and here lie the real problems and the
 hassles that led to Pascal ending up with a bad name -- one it should
 not be landed with in perpituity. 
I think Pascal did a good job of promoting "structured programming", the buzzword of the 70's. "User Friendly" was the buzzword of the 80s. "Object Oriented" for the 90s. "Generic" for the 00s. "Functional" for the teens, I suppose. Too soon to tell. I'm less forgiving of Pascal than you are. I have the original PUM&R, and yes, it was designed as a teaching language. But still, a teaching language shouldn't be so awfully crippled and with such huge mistakes (array handling). Modula-2 failed because by the time it appeared, everyone fed up with Pascal's failings had moved to C (and then C++). I remember a Modula-2 vendor telling me in the late 80's that they'd screwed up and backed the wrong horse, they should have gone with C++. Modula-2 also screwed up by not calling itself Pascal-2. I used OMSI Pascal in 1978 or so, I don't think it was related to Modula-2. Naturally, it had extensions, too. Pascal is unusable without extensions, even for simple programs. Pascal annoyed me so much, and C was *so* much better, I never gave M2 a serious look. Consider this: C today is still a dominant language, and is largely unchanged from the early 80's. But Pascal evolved into Modula, Modula 2, Oberon, Delphi, Object Pascal, etc., always trying to find a workable combination of features. Meanwhile, the world passed it by.
Oct 24 2010
parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
And with it we landed in a world full of buffer overruns and memory errors 
exploits.

Sure Pascal was a bit of a pain sometimes to use, but it did promote safety.

Now we have to fight an uphill battle with C developers to make them realize 
the benefict
of using safer languages while fixing security holes every day.

--
Paulo

"Walter Bright" <newshound2 digitalmars.com> wrote in message 
news:ia22e1$1upn$1 digitalmars.com...
 Russel Winder wrote:
 Pascal was never really intended as a production language, it was
 intended for teaching programming and the abstract concepts behind
 programming.  I suggest that in the period 1972-82 it achieved its goals
 admirably.  From 1984 onwards it was clearly becoming insufficient for
 the task and things moved on.

 Most of the commercial Pascal varieties tried to be variants on Modula-2
 but labelled themselves Pascal, and here lie the real problems and the
 hassles that led to Pascal ending up with a bad name -- one it should
 not be landed with in perpituity.
I think Pascal did a good job of promoting "structured programming", the buzzword of the 70's. "User Friendly" was the buzzword of the 80s. "Object Oriented" for the 90s. "Generic" for the 00s. "Functional" for the teens, I suppose. Too soon to tell. I'm less forgiving of Pascal than you are. I have the original PUM&R, and yes, it was designed as a teaching language. But still, a teaching language shouldn't be so awfully crippled and with such huge mistakes (array handling). Modula-2 failed because by the time it appeared, everyone fed up with Pascal's failings had moved to C (and then C++). I remember a Modula-2 vendor telling me in the late 80's that they'd screwed up and backed the wrong horse, they should have gone with C++. Modula-2 also screwed up by not calling itself Pascal-2. I used OMSI Pascal in 1978 or so, I don't think it was related to Modula-2. Naturally, it had extensions, too. Pascal is unusable without extensions, even for simple programs. Pascal annoyed me so much, and C was *so* much better, I never gave M2 a serious look. Consider this: C today is still a dominant language, and is largely unchanged from the early 80's. But Pascal evolved into Modula, Modula 2, Oberon, Delphi, Object Pascal, etc., always trying to find a workable combination of features. Meanwhile, the world passed it by.
Oct 25 2010
parent bearophile <bearophileHUGS lycos.com> writes:
Paulo Pinto:

 Now we have to fight an uphill battle with C developers to make them realize 
 the benefict
 of using safer languages while fixing security holes every day.
See bugs from integer overflows, for example. A "battle" that I'm willing to "fight" every day :-) D is a bit better than C in this regard, if you write a short program in C and then you write a similar program in D, you will probably put quite less bugs in compiler is a little more strict). Bye, bearophile "If debugging is the process of removing bugs, then programming must be the process of putting them in." -- Edsger W. Dijkstra
Oct 25 2010