digitalmars.D - How fast is D compared to C++?
- Jonathan M Davis (5/5) Mar 02 2011 I just thought that I'd point out this question on stackoverflow for tho...
- Trass3r (1/3) Mar 02 2011 I just can't imagine why in should be faster than const ref.
- Bekenn (7/8) Mar 02 2011 The use of ref introduces a level of indirection. I suspect the writer
- bearophile (4/5) Mar 02 2011 This is correct. But a minimally decent compiler must be able to remove ...
- Walter Bright (3/9) Mar 02 2011 Having the optimizer remove indirection is rarely possible in C or C++, ...
- dsimcha (6/15) Mar 02 2011 I'm sure there are tons of nitty-gritty details in implementing somethin...
- Walter Bright (9/24) Mar 02 2011 The check will cost you more than you win!
- Andrei Alexandrescu (4/27) Mar 02 2011 Often you stand to win a lot, albeit for simple functions (i.e. consider...
- %u (3/33) Mar 02 2011 What pisses me off is the Issac Guy doesn't want to support D in the gre...
- Jason E. Aten (5/16) Mar 02 2011 The benchmarks are public so they can be reproduced, right? That's the
- Andrei Alexandrescu (10/27) Mar 02 2011 I heartily encourage you two to go for this. This has been discussed in
- bearophile (4/9) Mar 02 2011 I think your are misunderstanding Isaac. You will probably not see D in ...
- Andrei Alexandrescu (4/13) Mar 02 2011 Shouldn't even matter, or at most, all the more reason to work on our
- Daniel Gibson (10/29) Mar 02 2011 Well, %u's point was that that shootout could attract developers (enterp...
- Andrei Alexandrescu (10/11) Mar 02 2011 I suggest we stop this discussion right here as there's no chance it
- Daniel Gibson (10/18) Mar 02 2011 Ok. It wasn't my intention to turn the discussion into a political direc...
- Jacob Carlborg (5/16) Mar 03 2011 How about we do our own benchmarks and perhaps Isaac is willing to put a...
- Thomas Mader (8/10) Mar 04 2011 You speak about http://shootout.alioth.debian.org/ right? They had D
- Isaac Gouy (3/5) Mar 04 2011 That's been answered many times -
-
uri
(2/10)
Mar 04 2011
Maybe if we push it enough, he will find time and motivation some day
- Jonathan M Davis (8/21) Mar 04 2011 He's been pushed too much already. Every time this comes up, someone com...
- Daniel Gibson (2/23) Mar 04 2011 In fact *he* just replied here, you're even quoting him ;-)
- Jonathan M Davis (3/29) Mar 04 2011 LOL. I need to pay more attention.
- Andrei Alexandrescu (5/10) Mar 05 2011 Hi Isaac. Heh, so I remembered correctly. We need to save this link to
- Isaac Gouy (7/10) Mar 05 2011 Here's the last time I posted that link to this list
- Trass3r (2/6) Mar 02 2011 Yeah I overlooked that, I always think of a struct when thinking about
I just thought that I'd point out this question on stackoverflow for those of you who don't regularly frequent stackoverflow. It has some fairly interesting info (such as in being faster than const ref - I would have guessed the opposite): http://stackoverflow.com/questions/5142366/how-fast-is-d-compared-to-c - Jonathan M Davis
Mar 02 2011
(such as in being faster than const ref - I would have guessed the opposite):I just can't imagine why in should be faster than const ref.
Mar 02 2011
On 3/2/11 11:40 AM, Trass3r wrote:I just can't imagine why in should be faster than const ref.The use of ref introduces a level of indirection. I suspect the writer was trying to avoid copying array elements -- unnecessary, since vector_t was defined as a dynamic array, where only the bounds are passed. With ref, every access to a vector_t object involves a pointer dereference. Take out the ref, and const should behave identically to in. (It had better -- in and const are synonyms!)
Mar 02 2011
Bekenn:The use of ref introduces a level of indirection.This is correct. But a minimally decent compiler must be able to remove this indirection where possible, like here, and produce efficient code. Bye, bearophile
Mar 02 2011
bearophile wrote:Bekenn:Having the optimizer remove indirection is rarely possible in C or C++, due to aliasing.The use of ref introduces a level of indirection.This is correct. But a minimally decent compiler must be able to remove this indirection where possible, like here, and produce efficient code.
Mar 02 2011
== Quote from Walter Bright (newshound2 digitalmars.com)'s articlebearophile wrote:I'm sure there are tons of nitty-gritty details in implementing something like this properly, but **in principle**, can't the compiler put a runtime check in for aliasing and select the code path based on whether aliasing is present or not? Essentially, you'd have two generated functions, one that handles the aliasing case and one that handles the no-aliasing case.Bekenn:Having the optimizer remove indirection is rarely possible in C or C++, due to aliasing.The use of ref introduces a level of indirection.This is correct. But a minimally decent compiler must be able to remove this indirection where possible, like here, and produce efficient code.
Mar 02 2011
dsimcha wrote:== Quote from Walter Bright (newshound2 digitalmars.com)'s articleThe check will cost you more than you win! But even a check is rarely even possible. Call any function in C/C++, and the optimizer has to throw in the towel on the values of any indirect references. Even if the optimizer can do interprocedural analysis, the source of that function may not be available to the compiler, or the function may be a virtual call. D has a number of characteristics which can permit much more aggressive optimization, but the opportunity is unrealized.bearophile wrote:I'm sure there are tons of nitty-gritty details in implementing something like this properly, but **in principle**, can't the compiler put a runtime check in for aliasing and select the code path based on whether aliasing is present or not? Essentially, you'd have two generated functions, one that handles the aliasing case and one that handles the no-aliasing case.Bekenn:Having the optimizer remove indirection is rarely possible in C or C++, due to aliasing.The use of ref introduces a level of indirection.This is correct. But a minimally decent compiler must be able to remove this indirection where possible, like here, and produce efficient code.
Mar 02 2011
On 3/2/11 3:20 PM, Walter Bright wrote:dsimcha wrote:Often you stand to win a lot, albeit for simple functions (i.e. consider memmove). Andrei== Quote from Walter Bright (newshound2 digitalmars.com)'s articleThe check will cost you more than you win!bearophile wrote:I'm sure there are tons of nitty-gritty details in implementing something like this properly, but **in principle**, can't the compiler put a runtime check in for aliasing and select the code path based on whether aliasing is present or not? Essentially, you'd have two generated functions, one that handles the aliasing case and one that handles the no-aliasing case.Bekenn:Having the optimizer remove indirection is rarely possible in C or C++, due to aliasing.The use of ref introduces a level of indirection.This is correct. But a minimally decent compiler must be able to remove this indirection where possible, like here, and produce efficient code.
Mar 02 2011
Andrei Alexandrescu Wrote:On 3/2/11 3:20 PM, Walter Bright wrote:What pisses me off is the Issac Guy doesn't want to support D in the great language benchmark. It's very important utlity for developers. Most coders with C and C++ mentality look the charts and only use the top-2 languages, that is C and C++. If D was there, we could get more users right now, because the optimization benefits make DMD the fastest. Probably even hundreds of enterprises go there to see what language to use. Everyone knows TIOBE is a joke, but this benchmark is probably the most important language benchmark in the web. D is not listed :-( I've been donating few hundred bucks annually to wikipedia, but the deletionist news force me to rethink this. I could donate them to Issac if he just supported our language. Must not be that hard?dsimcha wrote:Often you stand to win a lot, albeit for simple functions (i.e. consider memmove). Andrei== Quote from Walter Bright (newshound2 digitalmars.com)'s articleThe check will cost you more than you win!bearophile wrote:I'm sure there are tons of nitty-gritty details in implementing something like this properly, but **in principle**, can't the compiler put a runtime check in for aliasing and select the code path based on whether aliasing is present or not? Essentially, you'd have two generated functions, one that handles the aliasing case and one that handles the no-aliasing case.Bekenn:Having the optimizer remove indirection is rarely possible in C or C++, due to aliasing.The use of ref introduces a level of indirection.This is correct. But a minimally decent compiler must be able to remove this indirection where possible, like here, and produce efficient code.
Mar 02 2011
What pisses me off is the Issac Guy doesn't want to support D in the great language benchmark. It's very important utlity for developers. Most coders with C and C++ mentality look the charts and only use the top-2 languages, that is C and C++. If D was there, we could get more users right now, because the optimization benefits make DMD the fastest. Probably even hundreds of enterprises go there to see what language to use. Everyone knows TIOBE is a joke, but this benchmark is probably the most important language benchmark in the web. D is not listed :-( I've been donating few hundred bucks annually to wikipedia, but the deletionist news force me to rethink this. I could donate them to Issac if he just supported our language. Must not be that hard?The benchmarks are public so they can be reproduced, right? That's the standard for scientific publication. I can help you reproduce them and put up a webpage if you want to. But I would suggest that it's only really relevant to benchmark against C and C++. The rest is just eye candy. - Jason
Mar 02 2011
On 3/2/11 5:41 PM, Jason E. Aten wrote:What pisses me off is the Issac Guy doesn't want to support D in the great language benchmark. It's very important utlity for developers. Most coders with C and C++ mentality look the charts and only use the top-2 languages, that is C and C++. If D was there, we could get more users right now, because the optimization benefits make DMD the fastest. Probably even hundreds of enterprises go there to see what language to use. Everyone knows TIOBE is a joke, but this benchmark is probably the most important language benchmark in the web. D is not listed :-( I've been donating few hundred bucks annually to wikipedia, but the deletionist news force me to rethink this. I could donate them to Issac if he just supported our language. Must not be that hard? The benchmarks are public so they can be reproduced, right? That's the standard for scientific publication. I can help you reproduce them and put up a webpage if you want to. But I would suggest that it's only really relevant to benchmark against C and C++. The rest is just eye candy. - JasonI heartily encourage you two to go for this. This has been discussed in the past and my understanding is that Isaac has nothing against D but can't be bothered with a 32-bit setup. Perhaps now with the 64-bit edition maturing, we can look forward to seeing dmd reincluded. Of course, if the benchmarks are already set up properly and working, he'll be much easier compelled. Let me know if you need webspace, I'll be glad to help on d-programming-language.org and/or erdani.com. Andrei
Mar 02 2011
Andrei:my understanding is that Isaac has nothing against D but can't be bothered with a 32-bit setup. Perhaps now with the 64-bit edition maturing, we can look forward to seeing dmd reincluded. Of course, if the benchmarks are already set up properly and working, he'll be much easier compelled.I think your are misunderstanding Isaac. You will probably not see D in that site in a short time. Bye, bearophile
Mar 02 2011
On 3/2/11 6:38 PM, bearophile wrote:Andrei:Shouldn't even matter, or at most, all the more reason to work on our own benchmarks. Andreimy understanding is that Isaac has nothing against D but can't be bothered with a 32-bit setup. Perhaps now with the 64-bit edition maturing, we can look forward to seeing dmd reincluded. Of course, if the benchmarks are already set up properly and working, he'll be much easier compelled.I think your are misunderstanding Isaac. You will probably not see D in that site in a short time. Bye, bearophile
Mar 02 2011
Am 03.03.2011 02:01, schrieb Andrei Alexandrescu:On 3/2/11 6:38 PM, bearophile wrote:Well, %u's point was that that shootout could attract developers (enterprises even) to use D - even if they've never heard of D before (or haven't bothered much), if they see it listed on that page and if it performs well they may try D. But having no chance to get onto that page (in the near future) shouldn't prevent us from doing our own benchmarks, of course. It's just a pity that they won't get as much attention when they're not listed there. What were the reasons for not listing D anyway? Cheers, - DanielAndrei:Shouldn't even matter, or at most, all the more reason to work on our own benchmarks. Andreimy understanding is that Isaac has nothing against D but can't be bothered with a 32-bit setup. Perhaps now with the 64-bit edition maturing, we can look forward to seeing dmd reincluded. Of course, if the benchmarks are already set up properly and working, he'll be much easier compelled.I think your are misunderstanding Isaac. You will probably not see D in that site in a short time. Bye, bearophile
Mar 02 2011
On 3/2/11 7:09 PM, Daniel Gibson wrote:What were the reasons for not listing D anyway?I suggest we stop this discussion right here as there's no chance it doesn't turn political. It has occurred a couple of times in the past, with the effect that people wrote email to Isaac asking him the question above in a more or less demanding tone. The fact of the matter is, we can't annoy the man into putting D on the page. What we can do is make D more compelling and more visible by publishing our own benchmarks. This can only have positive effects, among which the possibility that D is added to that site. Andrei
Mar 02 2011
Am 03.03.2011 02:22, schrieb Andrei Alexandrescu:On 3/2/11 7:09 PM, Daniel Gibson wrote:Ok. It wasn't my intention to turn the discussion into a political direction. I thought maybe it were practical issues that could be fixed (or the D community could help), like "no 64bit support" or "setting it up for D (including writing benchmarking code) is much work and he doesn't have the time" or "prefers free compiler for D2" (nowadays GDC could be used) or whatever. I certainly wouldn't demand from Isaac to add D or anything (it's his spare time, after all). Cheers, - DanielWhat were the reasons for not listing D anyway?I suggest we stop this discussion right here as there's no chance it doesn't turn political. It has occurred a couple of times in the past, with the effect that people wrote email to Isaac asking him the question above in a more or less demanding tone.
Mar 02 2011
On 2011-03-03 02:22, Andrei Alexandrescu wrote:On 3/2/11 7:09 PM, Daniel Gibson wrote:How about we do our own benchmarks and perhaps Isaac is willing to put a link to the D benchmarks on his site. -- /Jacob CarlborgWhat were the reasons for not listing D anyway?I suggest we stop this discussion right here as there's no chance it doesn't turn political. It has occurred a couple of times in the past, with the effect that people wrote email to Isaac asking him the question above in a more or less demanding tone. The fact of the matter is, we can't annoy the man into putting D on the page. What we can do is make D more compelling and more visible by publishing our own benchmarks. This can only have positive effects, among which the possibility that D is added to that site. Andrei
Mar 03 2011
Am 2011-03-03 00:18, schrieb %u:What pisses me off is the Issac Guy doesn't want to support D in the great language benchmark. It's very important utlity for developers. Most coders with C and C++ mentality look the charts and only use the top-2 languages, that is C and C++. If D was there, we could get more users right now, because the optimization benefits make DMD the fastest. Probably even hundreds of enterprises go there to see what language to use. Everyone knows TIOBE is a joke, but this benchmark is probably the most important language benchmark in the web. D is not listed :-( I've been donating few hundred bucks annually to wikipedia, but the deletionist news force me to rethink this. I could donate them to Issac if he just supported our language. Must not be that hard?You speak about http://shootout.alioth.debian.org/ right? They had D listed but I don't know why they removed it. See http://replay.waybackmachine.org/20080409212431/http://shootout.alioth.debian.org/ And D is listed on http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html it's just not in the top 20 list. Thomas
Mar 04 2011
== Quote from Thomas Mader (thomas.mader gmail.com)'s articleYou speak about http://shootout.alioth.debian.org/ right? They had D listed but I don't know why they removed it.That's been answered many times - http://www.reddit.com/r/programming/comments/ckxjv/d_an_up_and_coming_embedded_software_language/c0u7uv8
Mar 04 2011
Isaac Gouy Wrote:== Quote from Thomas Mader (thomas.mader gmail.com)'s articleMaybe if we push it enough, he will find time and motivation some day <prays>.You speak about http://shootout.alioth.debian.org/ right? They had D listed but I don't know why they removed it.That's been answered many times - http://www.reddit.com/r/programming/comments/ckxjv/d_an_up_and_coming_embedded_software_language/c0u7uv8
Mar 04 2011
On Friday 04 March 2011 19:51:04 uri wrote:Isaac Gouy Wrote:He's been pushed too much already. Every time this comes up, someone complains about it, and likely someone bugs him directly about it. I get the impression that he's a bit fed up with it. He's even come to this list directly before (IIRC to say that he wouldn't take donations), in spite of the fact that as far as I know, he doesn't use D. He'll put D back if and when he puts D back. Until then, let's just leave him alone. - Jonathan M Davis== Quote from Thomas Mader (thomas.mader gmail.com)'s articleMaybe if we push it enough, he will find time and motivation some day <prays>.You speak about http://shootout.alioth.debian.org/ right? They had D listed but I don't know why they removed it.That's been answered many times - http://www.reddit.com/r/programming/comments/ckxjv/d_an_up_and_coming_emb edded_software_language/c0u7uv8
Mar 04 2011
Am 05.03.2011 05:35, schrieb Jonathan M Davis:On Friday 04 March 2011 19:51:04 uri wrote:In fact *he* just replied here, you're even quoting him ;-)Isaac Gouy Wrote:He's been pushed too much already. Every time this comes up, someone complains about it, and likely someone bugs him directly about it. I get the impression that he's a bit fed up with it. He's even come to this list directly before (IIRC to say that he wouldn't take donations), in spite of the fact that as far as I know, he doesn't use D. He'll put D back if and when he puts D back. Until then, let's just leave him alone. - Jonathan M Davis== Quote from Thomas Mader (thomas.mader gmail.com)'s articleMaybe if we push it enough, he will find time and motivation some day <prays>.You speak about http://shootout.alioth.debian.org/ right? They had D listed but I don't know why they removed it.That's been answered many times - http://www.reddit.com/r/programming/comments/ckxjv/d_an_up_and_coming_emb edded_software_language/c0u7uv8
Mar 04 2011
On Friday 04 March 2011 20:50:18 Daniel Gibson wrote:Am 05.03.2011 05:35, schrieb Jonathan M Davis:LOL. I need to pay more attention. - Jonathan M DavisOn Friday 04 March 2011 19:51:04 uri wrote:In fact *he* just replied here, you're even quoting him ;-)Isaac Gouy Wrote:He's been pushed too much already. Every time this comes up, someone complains about it, and likely someone bugs him directly about it. I get the impression that he's a bit fed up with it. He's even come to this list directly before (IIRC to say that he wouldn't take donations), in spite of the fact that as far as I know, he doesn't use D. He'll put D back if and when he puts D back. Until then, let's just leave him alone. - Jonathan M Davis== Quote from Thomas Mader (thomas.mader gmail.com)'s articleMaybe if we push it enough, he will find time and motivation some day <prays>.You speak about http://shootout.alioth.debian.org/ right? They had D listed but I don't know why they removed it.That's been answered many times - http://www.reddit.com/r/programming/comments/ckxjv/d_an_up_and_coming_e mb edded_software_language/c0u7uv8
Mar 04 2011
On 3/4/11 9:25 PM, Isaac Gouy wrote:== Quote from Thomas Mader (thomas.mader gmail.com)'s articleHi Isaac. Heh, so I remembered correctly. We need to save this link to stem future debates. We could use the energy thus saved for working on the benchmarks themselves. AndreiYou speak about http://shootout.alioth.debian.org/ right? They had D listed but I don't know why they removed it.That's been answered many times - http://www.reddit.com/r/programming/comments/ckxjv/d_an_up_and_coming_embedded_software_language/c0u7uv8
Mar 05 2011
== Quote from Andrei Alexandrescu (SeeWebsiteForEmail erdani.org)'s articleHi Isaac. Heh, so I remembered correctly. We need to save this link to stem future debates. We could use the energy thus saved for working on the benchmarks themselves.Here's the last time I posted that link to this list http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=120839 Here's the start of that thread http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=120760 A more generic version of the explanation is shown on the Help page http://shootout.alioth.debian.org/help.php#removed
Mar 05 2011
The use of ref introduces a level of indirection. I suspect the writer was trying to avoid copying array elements -- unnecessary, since vector_t was defined as a dynamic array, where only the bounds are passed.Yeah I overlooked that, I always think of a struct when thinking about vectors.
Mar 02 2011