Re: Is there a way to get a list of functions that get inlined by
>>> Use LDC (D1), you will note a significant improvement over DMD. >>> >> Unless you're on windows. >> > > Yep, second big problem. And unless you're using CodeBlocks (like me at the moment) for development ...
Re: Is there a way to get a list of functions that get inlined by
Use LDC (D1), you will note a significant improvement over DMD. Unless you're on windows. Yep, second big problem.
Re: Is there a way to get a list of functions that get inlined by
"bearophile" wrote in message news:hkpiai$2kt...@digitalmars.com... > Scorn: >> The only things i figured out so far is that functions across modules do >> not seem to get inlined (i don't know if this is the case in general) >> which would be really bad. Another thing which i believe is that >> functions / methods which contain ref parameters are never inlined at >> all (which is again really annoying since it's not a clever way passing >> huge structs by value). > > Use LDC (D1), you will note a significant improvement over DMD. > Unless you're on windows.
Re: Is there a way to get a list of functions that get inlined by
bearophile schrieb: > Scorn: >> The only things i figured out so far is that functions across modules do >> not seem to get inlined (i don't know if this is the case in general) >> which would be really bad. Another thing which i believe is that >> functions / methods which contain ref parameters are never inlined at >> all (which is again really annoying since it's not a clever way passing >> huge structs by value). > > Use LDC (D1), you will note a significant improvement over DMD. > > Bye, > bearophile Hi bearophile. Thanks for your advice (i might try out ldc in the future but now i need phobos and not tango as standard library). At the moment i am using gdc where i nearly always see a significant improvement regarding the speed of the produced code when comparing to dmd. But since all three dmd, ldc and gdc use the same frontend, the question from Trass3r still remains: Under which conditions are functions/methods inlined ? Do you know if ldc inlines functions/methods across modules ? (dmd doesn't seem to do it and neither does gdc). And that is bad since for an actual project i have made a separate module with a lot of small utility math functions which should be inlined but don't because of this. When i inline them using mixins or manually i get an overall speed up of about 20%.
Re: Is there a way to get a list of functions that get inlined by
Use LDC (D1), you will note a significant improvement over DMD. I believe that, but... D1. Also LDC doesn't seem to get much attention (development-wise) recently.
Re: Is there a way to get a list of functions that get inlined by
Scorn: > The only things i figured out so far is that functions across modules do > not seem to get inlined (i don't know if this is the case in general) > which would be really bad. Another thing which i believe is that > functions / methods which contain ref parameters are never inlined at > all (which is again really annoying since it's not a clever way passing > huge structs by value). Use LDC (D1), you will note a significant improvement over DMD. Bye, bearophile
Re: Why isn't == used to compare structs
Yes, I intentionally duped the string to make sure they're not using the same memory. I was thinking of something like a transitive ==. Overload opEquals.
Re: Why isn't == used to compare structs
On 2/8/10 13:48, Trass3r wrote: Why isn't == used to compare the struct members in the code above? I mean, if I compare the structs with == it could also use == to compare the members. If I use "is" to compare the structs it could use "is" to compare them members. Structs are compared *bitwise*! When you dup your pointer is different and thus the structs are different. Yes, I intentionally duped the string to make sure they're not using the same memory. I was thinking of something like a transitive ==.
Re: Why isn't == used to compare structs
On 2/8/10 14:58, Pelle Månsson wrote: On 02/08/2010 01:48 PM, Trass3r wrote: Why isn't == used to compare the struct members in the code above? I mean, if I compare the structs with == it could also use == to compare the members. If I use "is" to compare the structs it could use "is" to compare them members. Structs are compared *bitwise*! When you dup your pointer is different and thus the structs are different. I believe the question was *why* things are this way. I think it's weird. Yes that was the question.
Re: Is there a way to get a list of functions that get inlined by dmd?
Trass3r schrieb: > Would be interesting. Yes, this would be very interesting indeed. A list of the rules which dmd uses internally for inlining functions and methods similiar to this (which is for .NET) http://blogs.msdn.com/ericgu/archive/2004/01/29/64717.aspx would be really nice. Sure you can figure this out on your own by studying the compiler sources but a simple list of rules (does not have to be exhaustive) on http://www.digitalmars.com/d/1.0/lex.html or on a seperate page regarding optimizations for d would be very appreciated. The only things i figured out so far is that functions across modules do not seem to get inlined (i don't know if this is the case in general) which would be really bad. Another thing which i believe is that functions / methods which contain ref parameters are never inlined at all (which is again really annoying since it's not a clever way passing huge structs by value).
Is there a way to get a list of functions that get inlined by dmd?
Would be interesting.
Re: Why isn't == used to compare structs
I believe the question was *why* things are this way. I think it's weird. It's common behavior. In the end structs are just a way to map a memory range to some variable tuple. If you really need == for all members you can always overload opEquals!!
Re: Why isn't == used to compare structs
On 02/08/2010 01:48 PM, Trass3r wrote: Why isn't == used to compare the struct members in the code above? I mean, if I compare the structs with == it could also use == to compare the members. If I use "is" to compare the structs it could use "is" to compare them members. Structs are compared *bitwise*! When you dup your pointer is different and thus the structs are different. I believe the question was *why* things are this way. I think it's weird.
Re: Why isn't == used to compare structs
Why isn't == used to compare the struct members in the code above? I mean, if I compare the structs with == it could also use == to compare the members. If I use "is" to compare the structs it could use "is" to compare them members. Structs are compared *bitwise*! When you dup your pointer is different and thus the structs are different.
Re: Why isn't == used to compare structs
Am Mon, 08 Feb 2010 12:19:12 +0100 schrieb Jacob Carlborg : > struct String > { > char[] data; > } > > void main () > { > auto foo = String("foo"); > auto bar = String("foo".dup); > > assert(bar == foo); > } > > Why isn't == used to compare the struct members in the code above? I > mean, if I compare the structs with == it could also use == to > compare the members. If I use "is" to compare the structs it could > use "is" to compare them members. How should == be used for this struct? struct Foo { union { char[] dataA; long dataB; } } Foo a,b; a.dataA = "abc"; b.dataA = "abc".dup; Now a.dataA == b.dataA, but a.dataB != b.dataB.
Why isn't == used to compare structs
struct String { char[] data; } void main () { auto foo = String("foo"); auto bar = String("foo".dup); assert(bar == foo); } Why isn't == used to compare the struct members in the code above? I mean, if I compare the structs with == it could also use == to compare the members. If I use "is" to compare the structs it could use "is" to compare them members.
Re: interpret.c assertion failure on enum.stringof mixin
Don Wrote: > Wow, seems like you and the compiler are at war... > I had an even more horrid dmd crash some time ago, removing a circular selective import seemed to fix it. But I'm not sure and can't replicate it any more :( > > Please put this into bugzilla. Title "ICE(interpret.c): mixin non-CTFE > function" or similar. Done. Ah, ICE = Internal Compiler Error :) And, format isn't a CTFE-function? Could you maybe also help me with this one? enum E { A = 0, B, C } char[] _mixin(int i) { return "e = " ~ (cast(E)i).stringof ~ ";"; } void main() { E e; mixin( _mixin(1) ); } // Error: type E is not an expression I just want to use a var to index an enum and then get its .stringof :)
Re: interpret.c assertion failure on enum.stringof mixin
strtr wrote: strtr Wrote: enum { E }; void _mixin() { writefln( E.stringof ); } void func() { mixin(_mixin); } Assertion failure: '!dim || (parameters && (parameters->dim == dim))' on line 140 in file 'interpret.c' At least I got a line number this time :) Wow, seems like you and the compiler are at war... Had nothing to do with the enum :) void _mixin() { writefln( "" ); } void func() { mixin(_mixin); } Please put this into bugzilla. Title "ICE(interpret.c): mixin non-CTFE function" or similar.