Final makes no difference?

John Demme me at teqdruid.com
Thu Aug 24 04:33:34 PDT 2006


BCS wrote:

> John Demme wrote:
>> I'm working on fixing and optimizing my XML parser.  It uses some
>> classes, and lots of virtual method calls, so I figured I could really
>> increase my
>> speed by making everything final.  I made the classes final, and I put
>> all of the methods in a big final{} block, but it made no appreciable
>> difference in my time trials.
>> 
>> Am I doing something wrong?  Does DMD currently not optimize for final? 
>> Or are virtual method calls not nearly as bad as I thought? I'm making a
>> ton of calls into small functions, so I was also hoping final methods
>> would be candidates for inlining...
>> 
>> I'm using DMD 0.163 and compiling with -O and -inline.
>> 
>> Thanks
> 
> if you aren't using inheritance, try using structs.

Yeah, I know... I'm probably going to switch several of the classes over to
structs, but the big main class implements an interface.  I don't
absolultely need the speed right now- I'm just wondering if any changes
will be made in the future, and if I'm expecting the right thing from
final.

-- 
~John Demme
me at teqdruid.com
http://www.teqdruid.com/



More information about the Digitalmars-d-bugs mailing list