Re: Programming language benchmarks

2011-04-29 Thread Alexander
On 29.04.2011 14:48, Paulo Pinto wrote: > There are no slow or fast languages, there are slow or fast implementations > of a given language. But is is quite seldom that some language has several implementations, that's why compiler and language benchmarks are bound usually. For example - p

Re: Programming language benchmarks

2011-04-29 Thread Paulo Pinto
It is always about compiler benchmark. There are no slow or fast languages, there are slow or fast implementations of a given language. The only point that you can make about language related performance, is to say that a given language feature cannot be made to run any faster given the best c

Re: Programming language benchmarks

2011-04-29 Thread Alexander
On 28.04.2011 18:19, Daniel Gibson wrote: > Furthermore this particular benchmark is a "programming language benchmark" > and not a compiler benchmark, so it's fair to use every feature of the > language. But applicability of language features is a bit limited, I would say. I think, this is

Re: Programming language benchmarks

2011-04-29 Thread Alexey Prokhin
1500x1500:

Re: Programming language benchmarks

2011-04-29 Thread Alexey Prokhin
I also did a little benchmarks. Here is the results: Time for multiplying two 1000x1000 matrics: clang 2.8 (-O3)2.4s gcc 4.4.5 (-O3)2.5s ldc2 llvm-2.9 (-O3 -release) 2.7s gdc2 4.4.6 (-O3 -frelease -finline)2.9s dmd 2.05

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Francisco Almeida
== Quote from Walter Bright (newshou...@digitalmars.com)'s article > True, but dynamic arrays offer no inherent protection against overlap, though > you can add a runtime check for that. Another reason why we should have memory pool support in Phobos.

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Walter Bright
On 4/28/2011 9:10 PM, Don wrote: D reduces the use of pointers. You can do much more with arrays. True, but dynamic arrays offer no inherent protection against overlap, though you can add a runtime check for that.

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Don
Jens Mueller wrote: Andrei Alexandrescu wrote: On 4/28/11 12:57 PM, Jens Mueller wrote: Walter Bright wrote: On 4/28/2011 9:19 AM, Daniel Gibson wrote: But there's no need for a D compiler to optimize loops that just copy parts of an array into another array (and similar stuff), because in D

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Andrei Alexandrescu
On 4/28/11 7:53 PM, bearophile wrote: Andrei: C's restricts sets a poor example. There are infinite things that a compiler can't prove about the code. Restrict is particularly bad. See http://www.lysator.liu.se/c/dmr-on-noalias.html (noalias was the initial name of restrict). Andrei

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread bearophile
Andrei: > C's restricts sets a poor example. There are infinite things that a compiler can't prove about the code. Example: the type system can't prove that @system code that uses pointer arithmetic contains no bugs, pointers that go past arrays, etc. C99 restrict is just another example where

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Andrei Alexandrescu
On 4/28/11 4:14 PM, Jens Mueller wrote: Walter Bright wrote: On 4/28/2011 11:44 AM, Jens Mueller wrote: Thanks. So if a compiler can assume that pointers do not alias it can generate much better code. What's D's standpoint on that matter then? C99 has restrict. I never came across something sim

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread bearophile
Moritz Warning: > When the contents are both const, then there won't be any writing > to it, of course. In that case the same optimizations can be applied as > when they point to different memory. > > both arrays point to different memory. I see, thank you. Bye, bearophile

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Moritz Warning
On Thu, 28 Apr 2011 17:44:35 -0400, bearophile wrote: > Walter: > >> On 4/28/2011 11:44 AM, Jens Mueller wrote: >> > Thanks. So if a compiler can assume that pointers do not alias it can >> > generate much better code. What's D's standpoint on that matter then? >> > C99 has restrict. I never came

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread bearophile
Jens Mueller: > That allows specifying that the memory pointed to is only readable which > enables doing the optimizations. But what if the memory is writable but > I can my sure that the pointers pointing to it will never alias? How do > I pass that information to the compiler? Here's my answer.

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread bearophile
> "restrict" means "this pointer has no alias". Jens Mueller is right, it's not just pointers, a.ptr and b.ptr are distinct but they refer to memory zones that are not distinct: auto a = [1, 2, 3, 4, 5]; auto b = [1 .. 3]; Bye, bearophile

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread bearophile
Walter: > On 4/28/2011 11:44 AM, Jens Mueller wrote: > > Thanks. So if a compiler can assume that pointers do not alias it can > > generate much better code. What's D's standpoint on that matter then? > > C99 has restrict. I never came across something similar in D. > > Const and immutable. I do

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Jens Mueller
Timon Gehr wrote: > > That allows specifying that the memory pointed to is only readable which > > enables doing the optimizations. But what if the memory is writable but > > I can my sure that the pointers pointing to it will never alias? How do > > I pass that information to the compiler? > > > >

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Timon Gehr
> That allows specifying that the memory pointed to is only readable which > enables doing the optimizations. But what if the memory is writable but > I can my sure that the pointers pointing to it will never alias? How do > I pass that information to the compiler? > > Jens assert(p1 != p2); (or a

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Jens Mueller
Walter Bright wrote: > On 4/28/2011 11:44 AM, Jens Mueller wrote: > >Thanks. So if a compiler can assume that pointers do not alias it can > >generate much better code. What's D's standpoint on that matter then? > >C99 has restrict. I never came across something similar in D. > > Const and immutab

Re: Programming language benchmarks

2011-04-28 Thread Don
bearophile wrote: Andrei: Cristi's GSoC project may target linear algebra operations. That benchmark code is not a realistic example because don't write matrix multiplications manually like that. But the benchmark has found a weakness in array management that's important anyway. Bye, bearo

Re: Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Walter Bright
On 4/28/2011 11:44 AM, Jens Mueller wrote: Thanks. So if a compiler can assume that pointers do not alias it can generate much better code. What's D's standpoint on that matter then? C99 has restrict. I never came across something similar in D. Const and immutable.

Re: Programming language benchmarks

2011-04-28 Thread Dmitry Olshansky
On 28.04.2011 15:10, Francisco Almeida wrote: On 28-04-2011 12:57, Moritz Warning wrote: I think this might be interesting; it's also using D. http://attractivechaos.wordpress.com/2011/04/25/my-programming-language- benchmarks-plb/ Oh dear, the regex results for D are dreadful. An

Re: Programming language benchmarks

2011-04-28 Thread Jens Mueller
Walter Bright wrote: > On 4/28/2011 11:29 AM, Andrei Alexandrescu wrote: > >It's simple - Fortran can assume that all data is unaliased (although > >aliasing > >is still technically possible). C, with its intensive pointer-based ethos > >that > >makes many aliasing-related optimizations difficult

Re: Programming language benchmarks

2011-04-28 Thread Walter Bright
On 4/28/2011 11:29 AM, Andrei Alexandrescu wrote: It's simple - Fortran can assume that all data is unaliased (although aliasing is still technically possible). C, with its intensive pointer-based ethos that makes many aliasing-related optimizations difficult, has annoyed many a Fortran aficionad

Pointer aliasing in D (Was: Programming language benchmarks)

2011-04-28 Thread Jens Mueller
Andrei Alexandrescu wrote: > On 4/28/11 12:57 PM, Jens Mueller wrote: > >Walter Bright wrote: > >>On 4/28/2011 9:19 AM, Daniel Gibson wrote: > >>>But there's no need for a D compiler to optimize loops that just copy > >>>parts of an array into another array (and similar stuff), because in D > >>>yo

Re: Programming language benchmarks

2011-04-28 Thread Andrei Alexandrescu
On 4/28/11 12:57 PM, Jens Mueller wrote: Walter Bright wrote: On 4/28/2011 9:19 AM, Daniel Gibson wrote: But there's no need for a D compiler to optimize loops that just copy parts of an array into another array (and similar stuff), because in D you use slices for that - they're (probably) fast

Re: Programming language benchmarks

2011-04-28 Thread Jens Mueller
Walter Bright wrote: > On 4/28/2011 9:19 AM, Daniel Gibson wrote: > >But there's no need for a D compiler to optimize loops that just copy > >parts of an array into another array (and similar stuff), because in D > >you use slices for that - they're (probably) faster and easier to use. > >So IMHO i

Re: Programming language benchmarks

2011-04-28 Thread Walter Bright
On 4/28/2011 9:19 AM, Daniel Gibson wrote: But there's no need for a D compiler to optimize loops that just copy parts of an array into another array (and similar stuff), because in D you use slices for that - they're (probably) faster and easier to use. So IMHO it's fair to use slices where poss

Re: Programming language benchmarks

2011-04-28 Thread bearophile
Andrei: > Cristi's GSoC project may target linear algebra operations. That benchmark code is not a realistic example because don't write matrix multiplications manually like that. But the benchmark has found a weakness in array management that's important anyway. Bye, bearophile

Re: Programming language benchmarks

2011-04-28 Thread Daniel Gibson
Am 28.04.2011 18:10, schrieb Alexander: > On 28.04.2011 17:44, Andrej Mitrovic wrote: > >> >> But then these are not programming >language< benchmarks, they are >> >compiler< benchmarks. > > "compiler benchmark" is something that sh

Re: Programming language benchmarks

2011-04-28 Thread Alexander
On 28.04.2011 17:44, Andrej Mitrovic wrote: > > But then these are not programming >language< benchmarks, they are >compiler< > benchmarks. "compiler benchmark" is something that should measure compilation speed, for instance, but "language benchma

Re: Programming language benchmarks

2011-04-28 Thread Andrei Alexandrescu
On 4/28/11 6:50 AM, bearophile wrote: Moritz Warning: I think this might be interesting; it's also using D. I was about to post this :-) The little benchmark: http://attractivechaos.wordpress.com/2011/04/25/my-programming-language-benchmarks-plb/ http://attractivechaos.github.com/plb/

Re: Programming language benchmarks

2011-04-28 Thread Andrei Alexandrescu
On 4/28/11 6:10 AM, Francisco Almeida wrote: On 28-04-2011 12:57, Moritz Warning wrote: I think this might be interesting; it's also using D. http://attractivechaos.wordpress.com/2011/04/25/my-programming-language- benchmarks-plb/ Oh dear, the regex results for D are dreadful. And the m

Re: Programming language benchmarks

2011-04-28 Thread Andrej Mitrovic
r/optimizer (and VM, if any) are - for (almost) same code, same > algorithm. But then these are not programming >language< benchmarks, they are >compiler< benchmarks. If you can get more performance out of a language with less code and simpler syntax, then that language is better performing in my book.

Re: Programming language benchmarks

2011-04-28 Thread Moritz Warning
On Thu, 28 Apr 2011 07:50:19 -0400, bearophile wrote: > Moritz Warning: > >> I think this might be interesting; it's also using D. > > I was about to post this :-) I was surprised you haven't had already. Looks like I got lucky. :-) Have you seen somewhere what compiler options he did use for g

Re: Programming language benchmarks

2011-04-28 Thread bearophile
Moritz Warning: > I think this might be interesting; it's also using D. I was about to post this :-) The little benchmark: http://attractivechaos.wordpress.com/2011/04/25/my-programming-language-benchmarks-plb/ http://attractivechaos.github.com/plb/ (The matrix mul code is not a r

Re: Programming language benchmarks

2011-04-28 Thread Robert Clipsham
On 28/04/2011 12:37, Alexander wrote: On 28.04.2011 13:24, Robert Clipsham wrote: I also notice lots of nested for loops in some of the tests, which should be using slice operations really. This is the whole point of benchmarking, IMHO - to see how good compiler/optimizer (and VM, if any

Re: Programming language benchmarks

2011-04-28 Thread Alexander
On 28.04.2011 13:24, Robert Clipsham wrote: > I also notice lots of nested for loops in some of the tests, which should be > using slice operations really. This is the whole point of benchmarking, IMHO - to see how good compiler/optimizer (and VM, if any) are - for (almost) same code, same a

Re: Programming language benchmarks

2011-04-28 Thread Robert Clipsham
On 28/04/2011 12:13, Robert Clipsham wrote: On 28/04/2011 11:57, Moritz Warning wrote: I think this might be interesting; it's also using D. http://attractivechaos.wordpress.com/2011/04/25/my-programming-language- benchmarks-plb/ Looks like this is using an old version of gdc along wi

Re: Programming language benchmarks

2011-04-28 Thread Robert Clipsham
On 28/04/2011 11:57, Moritz Warning wrote: I think this might be interesting; it's also using D. http://attractivechaos.wordpress.com/2011/04/25/my-programming-language- benchmarks-plb/ Looks like this is using an old version of gdc along with D1, and it performs abysmally on quite a f

Re: Programming language benchmarks

2011-04-28 Thread Francisco Almeida
On 28-04-2011 12:57, Moritz Warning wrote: I think this might be interesting; it's also using D. http://attractivechaos.wordpress.com/2011/04/25/my-programming-language- benchmarks-plb/ Oh dear, the regex results for D are dreadful. And the matmul benchmark result isn't too e

Programming language benchmarks

2011-04-28 Thread Moritz Warning
I think this might be interesting; it's also using D. http://attractivechaos.wordpress.com/2011/04/25/my-programming-language- benchmarks-plb/