Re: Question about function templates and performance

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Wed, 09 Jan 2008 12:25:09 -0800, colin <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote:

the implicit conversion was at the top of the list of the profiler !
the real hog is LineIntersectLine routine wich was just beneath that.
the xna Vector3.subtract operation was about the same amount of time.

But what's the total time spent in the conversion versus the total time recorded by the profiler?

If you have a method that is used by a wide variety of other methods, it's not uncommon for it to show up at the top of a sorted list according to time in that method. But that doesn't mean the method represents a significant amount of your actual processing time. If it's used ten different places and only takes up 10% of the time spent, its time could still be larger than the time for any one of the users of the code. But eliminating the cost of conversion entirely would still only improve your performance by 10%.

[...]
this shaves about 10 seconds off the exectution time.
admitdely this is only about 5% percent,
but theres lots of other places where a similar conversion takes place,
and ofc lots of other data types but im just atacking anything at the top of
the profile list atm ...

But be sure that you are using the profile information correctly. Just because one method shows up at the top of the list, that doesn't mean that's the method you need to fix, or that doing so will result in any dramatic improvement in performance. It could be that for a really significant performance improvement, you simply need to visit multiple areas of the code and take out the fat in each area.

If the top item is only 10% of the total time, then your best improvement even eliminating it altogether is only going to be 10%. But if you've got 10 other places representing 90% of your time cost, where you can reduce the cost by half in each place, you can improve your total performance by 45%. Which one would you think is more important to focus on in that case?

is there anyway to control or even examine if functions are expanded inline?

You can use the ildasm.exe tool to inspect your code after it's compiled. There's an attribute that can prevent inlining, but I'm not aware of any to force it. However, my understanding is that the rules for inlining pretty much guarantee that a simple one-line return or assignment property getter or setter will be inlined.

Pete
.



Relevant Pages

  • I Need Help! Asap.
    ... I am trying to create a quote sheet. ... Based on the amount of users, it produces a cost associated. ... kristyb's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=37311 ...
    (microsoft.public.excel.newusers)
  • Re: Comparing multiple cells
    ... Actually I can use a helper sheet and make the column sequential. ... The Min formula you supplied does identify the least cost item. ... conversion I think we have it. ... scoobydoo2006's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=35372 ...
    (microsoft.public.excel.misc)
  • Re: A little political humor...
    ... A company can't run without SG&A expense. ... Neither Intel nor Dell is in the pharmaceutical business. ... What is the correct amount? ... >> Much of the cost of our legal system is hidden in SG&A. ...
    (comp.sys.mac.advocacy)
  • Re: News: Tax Protesters - Hovind in the news again.
    ... A certain amount of unfairness in that regard is unavoidable, but I still have a hard time seeing an accounting where Wesley cost the government anywhere near $12M. ... The taxation authority decides to build a highway. ... The first few times a millionaire winds up homeless and penniless because he tried to evade estate taxation, they'd get the hint that somehow Junior was going to have to earn his own way. ...
    (talk.origins)
  • Re: $3.00 meal for 3 people
    ... Not only that, most times the money comes in a monthly amount, and one ... fridge, freezer or pantry and only $3.00 are pretty slim. ... eight people cost $0.50, the sauce I made from tomatoes, peppers, ... The acorn squash was free from a neighbor's garden, ...
    (rec.food.cooking)