Re: Why is D slower than LuaJIT?

2010-12-23 Thread Lutger Blijdestijn
I meant to link this, it includes all benchmarks and ranks gdc at 5th place and dmd at 8 (from 2008): http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=all

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Lutger Blijdestijn
Andreas Mayer wrote: > Walter Bright Wrote: > >> I notice you are using doubles in D. dmd currently uses the x87 to >> evaluate doubles, and on some processors the x87 is slow relative to >> using the XMM instructions. Also, dmd's back end doesn't align the >> doubles on 16 byte boundaries, which

Re: Why is D slower than LuaJIT?

2010-12-23 Thread bearophile
Andrei: > I'm thinking what to do about iota, which has good features but exacts > too much cost on tight loop performance. One solution would be to define > iota to be the simple, forward range that I defined as Iota2 in my > previous post. Then, we need a different name for the full-fledged i

Re: What's the problem in opensourcing htod?

2010-12-23 Thread BLS
On 23/12/2010 05:34, Mariusz Gliwiński wrote: wig looks interesting. Again, it strips const so probably D1 (i just skipped D1, it wasn't interesting enough for me to switch from widely used languages so don't know it's feature-set) and it's using tango, but looks promising. SWIG 4 D uses D1/Tan

Re: Should Tuple!( T, "name" ) be implicitly castable to Tuple!T?

2010-12-23 Thread bearophile
Simen kjaeraas: > 1: > Tuple!(int, "a") a; > Tuple!int b; > b = a; > > IMO, this is good and correct. A tuple without field names is to me a > mere black box with data inside, and throwing some other data in there > is ok. I agree. > 2: > Tuple!( int, "a" ) a; > Tuple!int b; > a = b; > > This

How is the D programming language financed?

2010-12-23 Thread Thomas Mader
I would be interested in how the D programming language is financed as a project? As it seems the core projects at the moment are dmd, druntime and phobos. All of these are in a very active state with multiple contributors when judging the revision logs. I guess many of these contributors are

Re: rdmd and extern(C)

2010-12-23 Thread spir
On Thu, 23 Dec 2010 01:31:29 -0500 "Nick Sabalausky" wrote: > > Looks like a good enhancement for rdmd. That it doesn't "fail > > successfully" is a bug. May I suggest that rmdm prints out the command it sends to dmd (even when successful)? Not only it's "educative" but it should provide the c

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Pelle Månsson
On 12/22/2010 11:04 PM, Andreas Mayer wrote: To see what performance advantage D would give me over using a scripting language, I made a small benchmark. It consists of this code: auto L = iota(0.0, 1000.0); auto L2 = map!"a / 2"(L); auto L3 = map!"a + 2"(L2); auto V = redu

Re: Why is D slower than LuaJIT?

2010-12-23 Thread spir
On Wed, 22 Dec 2010 20:16:45 -0600 Andrei Alexandrescu wrote: > Thanks for posting the numbers. That's a long time, particularly > considering that the two map instances don't do anything. So the bulk of > the computation is: > > auto L = iota(0.0, 1000.0); > auto V = reduce!"a + b"(L3); >

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Simen kjaeraas
spir wrote: There is a point I don't understand here: Iota is a range-struct template, with void popFront() { current += step; } So, how does the computation of an arbitrary element at a given index affect looping speed? For mappings (and any kind of traversal, indeed),

Re: Why is D slower than LuaJIT?

2010-12-23 Thread bearophile
Simen kjaeraas: > With floating-point numbers, the above solution does not always work. The type is known at compile time, so you can split the algorithm in two with a "static if", and do something else if it's an integral type. Bye, bearophile

Re: How is the D programming language financed?

2010-12-23 Thread Justin Johansson
On 23/12/10 22:06, Thomas Mader wrote: I would be interested in how the D programming language is financed as a project? As it seems the core projects at the moment are dmd, druntime and phobos. All of these are in a very active state with multiple contributors when judging the revision logs. I

Re: Why is D slower than LuaJIT?

2010-12-23 Thread spir
On Wed, 22 Dec 2010 22:14:34 -0600 Andrei Alexandrescu wrote: > I then replaced iota's implementation with a simpler one that's a > forward range. Then the performance became exactly the same as for the > simple loop. After having watched Iota's very general implementation, I tried the same

Re: Why is D slower than LuaJIT?

2010-12-23 Thread spir
On Wed, 22 Dec 2010 23:22:56 -0600 Andrei Alexandrescu wrote: > I'm thinking what to do about iota, which has good features but exacts > too much cost on tight loop performance. One solution would be to define > iota to be the simple, forward range that I defined as Iota2 in my > previous post

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 05:22:55 spir wrote: > On Wed, 22 Dec 2010 23:22:56 -0600 > > Andrei Alexandrescu wrote: > > I'm thinking what to do about iota, which has good features but exacts > > too much cost on tight loop performance. One solution would be to define > > iota to be the simple,

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Simen kjaeraas
bearophile wrote: Simen kjaeraas: With floating-point numbers, the above solution does not always work. The type is known at compile time, so you can split the algorithm in two with a "static if", and do something else if it's an integral type. Absolutely. However, in this example doubl

Re: Why is D slower than LuaJIT?

2010-12-23 Thread spir
On Thu, 23 Dec 2010 05:29:32 -0800 Jonathan M Davis wrote: > On Thursday 23 December 2010 05:22:55 spir wrote: > > On Wed, 22 Dec 2010 23:22:56 -0600 > > > > Andrei Alexandrescu wrote: > > > I'm thinking what to do about iota, which has good features but exacts > > > too much cost on tight loop

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Simen kjaeraas
spir wrote: On Wed, 22 Dec 2010 23:22:56 -0600 Andrei Alexandrescu wrote: I'm thinking what to do about iota, which has good features but exacts too much cost on tight loop performance. One solution would be to define iota to be the simple, forward range that I defined as Iota2 in my previou

Re: Why is D slower than LuaJIT?

2010-12-23 Thread spir
On Thu, 23 Dec 2010 14:40:13 +0100 "Simen kjaeraas" wrote: > > What kind of thingie does "i..j" actually construct as of now? > > Nothing. The syntax only works in foreach and opSlice. > > However, this works: > > final abstract class Intervals { > struct Interval( T ) { > T st

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/22/10 11:40 PM, Brad Roberts wrote: Since the timing code isn't here, I'm assuming you guys are doing the testing around the whole app. While that might be interesting, it's hiding an awfully large and important difference, application startup time. C has very little, D quite a bit more,

Re: rdmd and extern(C)

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 12:31 AM, Nick Sabalausky wrote: "Andrei Alexandrescu" wrote in message news:iethab$2dj...@digitalmars.com... On 12/22/10 12:13 PM, spir wrote: Hello, Is it possible use rdmd (to automagically link against imported D modules), when also calling C funcs? I tried to add the C file a

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 2:52 AM, bearophile wrote: Andrei: I'm thinking what to do about iota, which has good features but exacts too much cost on tight loop performance. One solution would be to define iota to be the simple, forward range that I defined as Iota2 in my previous post. Then, we need a differ

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/22/10 8:16 PM, Andrei Alexandrescu wrote: On 12/22/10 4:04 PM, Andreas Mayer wrote: To see what performance advantage D would give me over using a scripting language, I made a small benchmark. It consists of this code: auto L = iota(0.0, 1000.0); auto L2 = map!"a / 2"(L); auto L3 = m

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 6:57 AM, bearophile wrote: Simen kjaeraas: With floating-point numbers, the above solution does not always work. The type is known at compile time, so you can split the algorithm in two with a "static if", and do something else if it's an integral type. That's what the code cur

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 7:04 AM, spir wrote: On Wed, 22 Dec 2010 22:14:34 -0600 Andrei Alexandrescu wrote: I then replaced iota's implementation with a simpler one that's a forward range. Then the performance became exactly the same as for the simple loop. After having watched Iota's very general imple

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 6:22 AM, spir wrote: On Wed, 22 Dec 2010 20:16:45 -0600 Andrei Alexandrescu wrote: Thanks for posting the numbers. That's a long time, particularly considering that the two map instances don't do anything. So the bulk of the computation is: auto L = iota(0.0, 1000.0); auto V =

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/22/10 4:04 PM, Andreas Mayer wrote: To see what performance advantage D would give me over using a scripting language, I made a small benchmark. It consists of this code: auto L = iota(0.0, 1000.0); auto L2 = map!"a / 2"(L); auto L3 = map!"a + 2"(L2); auto V = reduce!

Re: Is std.demangle usable?

2010-12-23 Thread kenji hara
I tested this issue. I think mangledName does not support nested function. I'll try to resolve it. Kenji Hara 2010/12/23 Andrej Mitrovic : > import std.stdio; > import std.demangle; > import std.traits; > > void main() > { >    void test() >    { >    } > >    auto mystr = mangledName!(test); //

Re: Is std.demangle usable?

2010-12-23 Thread Stanislav Blinov
23.12.2010 7:49, Andrej Mitrovic пишет: On 12/23/10, Sean Kelly wrote: Okay, I'm about to check in this change. With it, demangle works on the string you supplied provided it's prefixed with "_D8" or "D8". Simply having "demangle4mainFAAyaZv4testMFZv" isn't a complete symbol. Thanks. It wor

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Simen kjaeraas
Andrei Alexandrescu wrote: I decided to check in the map cache removal. We discussed it a fair amount among Phobos devs. I have no doubts caching might help in certain cases, but it does lead to surprising performance loss for simple cases like the one tested here. See http://www.dsource

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Simen kjaeraas
Andrei Alexandrescu wrote: http://www.dsource.org/projects/phobos/changeset/2231 BTW, shouldn't range constructors call .save for forward ranges? This one certainly doesn't. -- Simen

Re: What's the problem in opensourcing htod?

2010-12-23 Thread Andrej Mitrovic
I think you just need to pass a flag to SWIG when building it to get D2 support. I've done it a few days ago.. On 12/23/10, BLS wrote: > On 23/12/2010 05:34, Mariusz Gliwiński wrote: >> wig looks interesting. Again, it strips const so probably D1 (i just >> skipped >> D1, it wasn't interesting en

Re: Is std.demangle usable?

2010-12-23 Thread Andrej Mitrovic
On 12/23/10, Stanislav Blinov wrote: > Do you mean it works with _D3 even for mangled name starting with > "demangle"? It shouldn't. 3 is a character count of the following name. No, I meant without "demangle", so that's fine. > I beleive the hex part at the end is a hash that is used to mangle

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 10:09 AM, Simen kjaeraas wrote: Andrei Alexandrescu wrote: I decided to check in the map cache removal. We discussed it a fair amount among Phobos devs. I have no doubts caching might help in certain cases, but it does lead to surprising performance loss for simple cases like the o

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 10:14 AM, Simen kjaeraas wrote: Andrei Alexandrescu wrote: http://www.dsource.org/projects/phobos/changeset/2231 BTW, shouldn't range constructors call .save for forward ranges? This one certainly doesn't. Currently higher-order ranges assume that the range passed-in is good to

Re: rdmd and extern(C)

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 5:23 AM, spir wrote: On Thu, 23 Dec 2010 01:31:29 -0500 "Nick Sabalausky" wrote: Looks like a good enhancement for rdmd. That it doesn't "fail successfully" is a bug. May I suggest that rmdm prints out the command it sends to dmd (even when successful)? Not only it's "educative"

Re: How is the D programming language financed?

2010-12-23 Thread Thomas Mader
Am 2010-12-23 13:57, schrieb Justin Johansson: On 23/12/10 22:06, Thomas Mader wrote: I would be interested in how the D programming language is financed as a project? As it seems the core projects at the moment are dmd, druntime and phobos. All of these are in a very active state with multiple

Re: Is std.demangle usable?

2010-12-23 Thread kenji hara
Sorry, current dmd does't provide the mangled name from function symbol. see http://d.puremagic.com/issues/show_bug.cgi?id=2774 2010/12/24 kenji hara : > I tested this issue. > I think mangledName does not support nested function. > I'll try to resolve it. > > Kenji Hara > > 2010/12/23 Andrej Mitr

Re: How is the D programming language financed?

2010-12-23 Thread Adam D. Ruppe
Thomas Mader wrote: > I guess many of these contributors are volunteers but > are there also people who get somehow money for their work? Yup. I use D almost exclusively in my professional work, and if something bugs me in the course of that, I fix it, and if applicable, submit the fix back upstre

Re: Is std.demangle usable?

2010-12-23 Thread Andrej Mitrovic
Okay, thanks for letting me know! On 12/23/10, kenji hara wrote: > Sorry, current dmd does't provide the mangled name from function symbol. > see http://d.puremagic.com/issues/show_bug.cgi?id=2774 > > 2010/12/24 kenji hara : >> I tested this issue. >> I think mangledName does not support nested f

Re: rdmd and extern(C)

2010-12-23 Thread Nick Sabalausky
"Andrei Alexandrescu" wrote in message news:ievlbg$el...@digitalmars.com... > On 12/23/10 12:31 AM, Nick Sabalausky wrote: >> "Andrei Alexandrescu" wrote in message >> news:iethab$2dj...@digitalmars.com... >>> On 12/22/10 12:13 PM, spir wrote: Hello, Is it possible use rdmd (to au

Re: rdmd and extern(C)

2010-12-23 Thread Nick Sabalausky
"Nick Sabalausky" wrote in message news:if04me$1vp...@digitalmars.com... > "Andrei Alexandrescu" wrote in message > news:ievlbg$el...@digitalmars.com... >> On 12/23/10 12:31 AM, Nick Sabalausky wrote: >>> "Andrei Alexandrescu" wrote in message >>> news:iethab$2dj...@digitalmars.com... On

Re: How is the D programming language financed?

2010-12-23 Thread Eric Poggel
On 12/23/2010 7:57 AM, Justin Johansson wrote: On 23/12/10 22:06, Thomas Mader wrote: I would be interested in how the D programming language is financed as a project? As it seems the core projects at the moment are dmd, druntime and phobos. All of these are in a very active state with multiple

Re: How is the D programming language financed?

2010-12-23 Thread spir
On Thu, 23 Dec 2010 17:41:06 +0100 Thomas Mader wrote: > I think it's very important for D to step into the corporate world to > get more stability, a bigger community and therefore a stronger toolchain. > For this to happen companies need trust in the future of the project and > the future are

Re: How is the D programming language financed?

2010-12-23 Thread Thomas Mader
Am 2010-12-23 21:01, schrieb spir: On Thu, 23 Dec 2010 17:41:06 +0100 Thomas Mader wrote: I think it's very important for D to step into the corporate world to get more stability, a bigger community and therefore a stronger toolchain. For this to happen companies need trust in the future of th

Re: How is the D programming language financed?

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 12:43:11 Thomas Mader wrote: > Am 2010-12-23 21:01, schrieb spir: > > On Thu, 23 Dec 2010 17:41:06 +0100 > > > > Thomas Mader wrote: > >> I think it's very important for D to step into the corporate world to > >> get more stability, a bigger community and therefore a

Re: How is the D programming language financed?

2010-12-23 Thread Steven Schveighoffer
On Thu, 23 Dec 2010 15:43:11 -0500, Thomas Mader wrote: Am 2010-12-23 21:01, schrieb spir: On Thu, 23 Dec 2010 17:41:06 +0100 Thomas Mader wrote: I think it's very important for D to step into the corporate world to get more stability, a bigger community and therefore a stronger toolcha

Re: How is the D programming language financed?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 3:21 PM, Steven Schveighoffer wrote: On Thu, 23 Dec 2010 15:43:11 -0500, Thomas Mader wrote: Am 2010-12-23 21:01, schrieb spir: On Thu, 23 Dec 2010 17:41:06 +0100 Thomas Mader wrote: I think it's very important for D to step into the corporate world to get more stability, a bigg

Re: How is the D programming language financed?

2010-12-23 Thread Adam D. Ruppe
Andrei Alexandrescu wrote: > I think the bread and butter support > is as rock solid in both languages. I agree. For my day to day work, I'm pretty conservative in the use of the language; 90% of my code is probably best characterized as "a better C". Interestingly though, I use a template of som

Re: How is the D programming language financed?

2010-12-23 Thread Caligo
You got me excited, so I decided to give GDC another try. I cloned the repo, and using GCC 4.4.5, it compiled without errors. I started following the examples in TDPL, but the Stat program on page 22 gives the following errors: t1.d:33: Error: void has no value t1.d:33: Error: incompatible types

Re: How is the D programming language financed?

2010-12-23 Thread Iain Buclaw
== Quote from Caligo (iteronve...@gmail.com)'s article > --001636e0a9cc00219904981c2ad9 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: quoted-printable > You got me excited, so I decided to give GDC another try. I cloned the > repo, and using GCC 4.4.5, it compiled without

Re: How is the D programming language financed?

2010-12-23 Thread Iain Buclaw
== Quote from Iain Buclaw (ibuc...@ubuntu.com)'s article > == Quote from Caligo (iteronve...@gmail.com)'s article > > --001636e0a9cc00219904981c2ad9 > > Content-Type: text/plain; charset=UTF-8 > > Content-Transfer-Encoding: quoted-printable > > You got me excited, so I decided to give GDC another t

Re: How is the D programming language financed?

2010-12-23 Thread Andrej Mitrovic
On 12/24/10, Caligo wrote: > You got me excited, so I decided to give GDC another try. I cloned the > repo, and using GCC 4.4.5, it compiled without errors. > I started following the examples in TDPL, but the Stat program on page 22 > gives the following errors: > > t1.d:33: Error: void has no va

Re: How is the D programming language financed?

2010-12-23 Thread Andrej Mitrovic
On 12/24/10, Andrej Mitrovic wrote: > Use stdin.readf: And don't forget to catch those exceptions! import std.exception, std.stdio, std.conv; void main(string[] args) { try { for (double x; stdin.readf(" %s ", &x) == 1;) { writeln(x); // or was it stat.postpr

Re: How is the D programming language financed?

2010-12-23 Thread Caligo
On Thu, Dec 23, 2010 at 5:38 PM, Andrej Mitrovic wrote: > On 12/24/10, Caligo wrote: > > You got me excited, so I decided to give GDC another try. I cloned the > > repo, and using GCC 4.4.5, it compiled without errors. > > I started following the examples in TDPL, but the Stat program on page 2

Re: How is the D programming language financed?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 5:50 PM, Caligo wrote: On Thu, Dec 23, 2010 at 5:38 PM, Andrej Mitrovic mailto:andrej.mitrov...@gmail.com>> wrote: On 12/24/10, Caligo mailto:iteronve...@gmail.com>> wrote: > You got me excited, so I decided to give GDC another try. I cloned the > repo, and using

Re: How is the D programming language financed?

2010-12-23 Thread Caligo
I hope I didn't miss anything; I copied it from the book. import std.stdio, std.exception; interface Stat{ void accumulate(double x); void postprocess(); double result(); } class Min : Stat{ private double min = double.max; void accumulate(double x){ if( x < min ){

Re: How is the D programming language financed?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 6:11 PM, Caligo wrote: I hope I didn't miss anything; I copied it from the book. Looking good, I reproduced the exception as a miscommunication between readf and parse. Give me a little time to look into this. Andrei

Re: How is the D programming language financed?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 6:11 PM, Caligo wrote: I hope I didn't miss anything; I copied it from the book. [snip] http://www.dsource.org/projects/phobos/changeset/2233 Don't forget to call your program stats.d or put a module stats declaration at its top. Andrei

Re: How is the D programming language financed?

2010-12-23 Thread Andrej Mitrovic
On 12/24/10, Andrei Alexandrescu wrote: > Don't forget to call your program stats.d or put a module stats > declaration at its top. > > Andrei > Hardcoding module names in our code?! I beg to differ, sir! module testmodule; import std.string : split; import std.stdio : writeln; string modulena

Re: How is the D programming language financed?

2010-12-23 Thread Caligo
Thanks, Andrei. You're the best. On Thu, Dec 23, 2010 at 9:14 PM, Andrei Alexandrescu < seewebsiteforem...@erdani.org> wrote: > On 12/23/10 6:11 PM, Caligo wrote: > >> I hope I didn't miss anything; I copied it from the book. >> > [snip] > > http://www.dsource.org/projects/phobos/changeset/2233 >

Re: How is the D programming language financed?

2010-12-23 Thread Andrei Alexandrescu
On 12/23/10 9:35 PM, Andrej Mitrovic wrote: module testmodule; import std.string : split; import std.stdio : writeln; string modulename = split(.stringof)[1]; void main() { writeln(modulename); } What the... I didn't know you can do that. Thanks for the tip! Andrei

Re: How is the D programming language financed?

2010-12-23 Thread Caligo
I don't get it. How is it able to get the name of the module like that? On Thu, Dec 23, 2010 at 9:35 PM, Andrej Mitrovic wrote: > On 12/24/10, Andrei Alexandrescu wrote: > > Don't forget to call your program stats.d or put a module stats > > declaration at its top. > > > > Andrei > > > > Hardc

assocArray.remove() gives strange error

2010-12-23 Thread Mariusz Gliwiński
When i compile: type[key2][key1] assocArray1; assocArray1[key1].remove(key2); everything is ok, but building type[key2][key1] assocArray1; return (assocArray1[key1].remove(key2)); gives dmd: expression.c:817: void expToCBuffer(OutBuffer*, HdrGenState*, Expression*, PREC): Assertion `pr != PREC_z

Re: Why is D slower than LuaJIT?

2010-12-23 Thread Jimmy Cao
I hope that in the future more implementations in D can be compared for performance against their equivalent Lua translations. It seems that LuaJIT is a super speedy dynamic language, and it is specifically designed to break into the performance ranges of optimized static languages, which makes it

Re: How is the D programming language financed?

2010-12-23 Thread Daniel Gibson
Am 23.12.2010 23:18, schrieb Andrei Alexandrescu: I wonder how stable D2 is when used as a "better D1", i.e. making conservative use of new features. I think the bread and butter support is as rock solid in both languages. Depends on what parts of Phobos you use, I guess. For example the strea

Re: What's the problem in opensourcing htod?

2010-12-23 Thread Jimmy Cao
On Thu, Dec 23, 2010 at 10:29 AM, Andrej Mitrovic < andrej.mitrov...@gmail.com> wrote: > I think you just need to pass a flag to SWIG when building it to get > D2 support. I've done it a few days ago.. > > On 12/23/10, BLS wrote: > > On 23/12/2010 05:34, Mariusz Gliwiński wrote: > >> wig looks in