www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Again struct initialization

reply Leopold Walkling <leopold_walkling web.de> writes:
I've asked for this once but I didn't get satisfieing answers. My 
problem is this static opCall; I had to use the profiler in order to 
find the fastes implementation:
the static keyword makes the creation of the return struct up to 200 
times slower! I used obj2asm and the profiler to find out that the 
creation of the internal return value isn't "optimized away" at all.

Another thing that hurts is that an easy operation like 
assignment/cast/initialization to a struct have to be implemented 
through an opCall; Why do I have to assign each value manually to a 
struct (if I don't/can't implement a static opCall)

merry christmas!
Leo
Dec 23 2006
parent reply Daniel Keep <daniel.keep+lists gmail.com> writes:
Leopold Walkling wrote:
 I've asked for this once but I didn't get satisfieing answers. My 
 problem is this static opCall; I had to use the profiler in order to 
 find the fastes implementation:
 the static keyword makes the creation of the return struct up to 200 
 times slower! I used obj2asm and the profiler to find out that the 
 creation of the internal return value isn't "optimized away" at all.
 
 Another thing that hurts is that an easy operation like 
 assignment/cast/initialization to a struct have to be implemented 
 through an opCall; Why do I have to assign each value manually to a 
 struct (if I don't/can't implement a static opCall)
 
 merry christmas!
 Leo
Just a quick question: what compiler flags did you use, and what code did you use? I did some analysis on generated code a while back, and the different compiler flags produced wildly varying results. (Also: obj2asm? You're lucky. I had to use ndisasmw and magic numbers littered through the code :3) -- Daniel
Dec 23 2006
parent Leopold Walkling <leopold_walkling web.de> writes:
Daniel Keep schrieb:
 Just a quick question: what compiler flags did you use, and what code 
 did you use?  I did some analysis on generated code a while back, and 
 the different compiler flags produced wildly varying results.
 
 (Also: obj2asm?  You're lucky.  I had to use ndisasmw and magic numbers 
 littered through the code :3)
 
     -- Daniel
I used -O -inline -release -profile and some of those build switches, but those shouldn't change anything
Dec 23 2006