Thursday, March 29, 2012

Performance questions

Hi

I have 2 different sites with the same aspnet code.
Both are running in their own app pool.

1st one is the important site and performance for this one is more important
than the second one.
Of course in the codes I have some customization routines.

One of those routine shows and assigns url for a hyperlink.
For the important (high traffic) site (site 1) I need to show that link and
for the 2nd site I need to hide that link.

Now the question is:
Should I make this hyperlink visible from the HTML part which will be
suitable for site 1 and hide it from codebehind in the second site?
Is there any performance difference doing the vise versa?

The following is the code I have now:
if (Site1)
{
hyperlink.NavigateUrl = "Default.aspx";
}
else
{
hyperlink.Visible = false;
}

However the following code looks nicer but will it give any performance hit
to site 1?
if (Site1)
{
hyperlink.NavigateUrl = "Default.aspx";
hyperlink.Visible = true;
}

Looking forward for your advise.
--

SevDer
http://www.sevder.com
A new source for .NET DevelopersI don't think this is kind of code would be the performance bottleneck.
Typically it is either related to database access, or complicated
calculations or processing in the code. Setting one property on a hyperlink
isn't going to make a difference.

"SevDer" <sevder@.newsgroup.nospamwrote in message
news:etavoPztGHA.4752@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hi
>
I have 2 different sites with the same aspnet code.
Both are running in their own app pool.
>
1st one is the important site and performance for this one is more
important than the second one.
Of course in the codes I have some customization routines.
>
One of those routine shows and assigns url for a hyperlink.
For the important (high traffic) site (site 1) I need to show that link
and for the 2nd site I need to hide that link.
>
Now the question is:
Should I make this hyperlink visible from the HTML part which will be
suitable for site 1 and hide it from codebehind in the second site?
Is there any performance difference doing the vise versa?
>
The following is the code I have now:
if (Site1)
{
hyperlink.NavigateUrl = "Default.aspx";
}
else
{
hyperlink.Visible = false;
}
>
However the following code looks nicer but will it give any performance
hit to site 1?
if (Site1)
{
hyperlink.NavigateUrl = "Default.aspx";
hyperlink.Visible = true;
}
>
Looking forward for your advise.
--
>
SevDer
http://www.sevder.com
A new source for .NET Developers
>
>
>


I don't think that either of these options will have much of an effect on performance... how often is this code called?

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Hi,

I don't really have a problem with the performance and the difference
between them is may be 1/10000000 but I just want to know which one is
faster.
May be in the future this information may help me on 100 show or hide items
in one page where there are tremendous amount of hits to that page.

--

SevDer
http://www.sevder.com
A new source for .NET Developers

"Greg Collins [Microsoft MVP]" <gcollins_AT_msn_DOT_comwrote in message
news:%23Ydm2TztGHA.4456@.TK2MSFTNGP06.phx.gbl...
I don't think that either of these options will have much of an effect on
performance... how often is this code called?

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Well, if you have to set 2 properties instead of 1, then setting 2 will take
longer.

But even with 100 of these controls, you aren't going to see a difference.
This is just changing a variable in an object. That variable is used when
it's time to generate the corresponding HTML. But by setting the property,
you are just changing some local variable to the object.

Again, unless you have tens of thousands of these, this isn't going to make
a difference. I would focus on more likely bottlenecks in terms of
performance.

"SevDer" <sevder@.newsgroup.nospamwrote in message
news:%23jry6iztGHA.4752@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

Hi,
>
I don't really have a problem with the performance and the difference
between them is may be 1/10000000 but I just want to know which one is
faster.
May be in the future this information may help me on 100 show or hide
items in one page where there are tremendous amount of hits to that page.
>
--
>
SevDer
http://www.sevder.com
A new source for .NET Developers
>
>
"Greg Collins [Microsoft MVP]" <gcollins_AT_msn_DOT_comwrote in message
news:%23Ydm2TztGHA.4456@.TK2MSFTNGP06.phx.gbl...
I don't think that either of these options will have much of an effect on
performance... how often is this code called?
>
--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
>
>
>

0 comments:

Post a Comment