473,569 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dear MVP - Web control performance enquiries


Dear MVP,

A small question to you all
Lets say I have an application which gets the value from a drop down list,
e.g.

GetProductInfo1 (ddl.selectedIt em.value)
GetProductInfo2 (ddl.selectedIt em.value)
GetProductInfo3 (ddl.selectedIt em.value)
GetProductInfo4 (ddl.selectedIt em.value)
GetProductInfo5 (ddl.selectedIt em.value)

If you notice, I’m repeating ddl.selectedIte m.value 5 times, would it be
better if I just put it into a variable e.g.

Dim int as integer

Int = ddl.selectedIte m.value

And from there I just use the variable when ever I need it, rather then
having it call this stmt ddl.selectedIte m.value. would it improve performance?

Thanks for taking the time to read this post.
Nov 18 '05 #1
1 1590
Hi,

I'm not an MVP but I can answer this for you. If you are just using it 5
times you will not notice much of a performance boost by putting it into a
variable. However, if you were using this in a loop that had a ton of
iterations you would see a *small* gain in performance. Also it looks like
your GetProductInfoX () functions take an Integer. So by doing this:

Dim int as Integer
int = CInt(ddl.Select edItem.Value)

And then using int in your function calls you will also increase performance
because the CLR won't have to perform the conversion 5 times. Again, since
it is only used 5 times the performance will hardly be measurable. But if
this was in a loop then the conversion for each iteration would cost you a
little bit.

By putting Option Strict On at the beginning of each code file you will see
where the CLR is doing all your conversions for you. If they are in loops
then doing the conversion yourself and using the result will optimize your
code. It could also help you catch tricky errors that occur when the CLR
tries to figure out what your trying to do but gets it wrong. Good luck!
Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight

"Asha" <As**@discussio ns.microsoft.co m> wrote in message
news:DC******** *************** ***********@mic rosoft.com...

Dear MVP,

A small question to you all
Lets say I have an application which gets the value from a drop down list,
e.g.

GetProductInfo1 (ddl.selectedIt em.value)
GetProductInfo2 (ddl.selectedIt em.value)
GetProductInfo3 (ddl.selectedIt em.value)
GetProductInfo4 (ddl.selectedIt em.value)
GetProductInfo5 (ddl.selectedIt em.value)

If you notice, I'm repeating ddl.selectedIte m.value 5 times, would it be
better if I just put it into a variable e.g.

Dim int as integer

Int = ddl.selectedIte m.value

And from there I just use the variable when ever I need it, rather then
having it call this stmt ddl.selectedIte m.value. would it improve performance?
Thanks for taking the time to read this post.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
10105
by: Jack | last post by:
Hello, <TABLE BORDER=1 CELLSPACING=0> <TR> <TH> <style="WIDTH=10"> ABC </TH> <TH> <style="WIDTH=500"> DEF
9
1754
by: Alvin Bruney [MVP] | last post by:
Exceptions must not be used to control program flow. I intend to show that this statement is flawed. In some instances, exceptions may be used to control program flow in ways that can lead to improved code readability and performance. Consider an application that must eliminate duplicates in a list. using system.collections;
7
7725
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control which will be used to query sql server to repopulate the datagrid in the user control. I also wrapped the user control in a panel element so I...
0
1001
by: Darren | last post by:
Hello, I am trying to design an ASP system which will submit the contents of a feedback form to a partner, based on a daily maximum number of feedback forms per day. For example, if partner1 whishes to receive no more than 5 feedback forms per day, then I want the system to check how many forms it has submitted to partner1 in previous...
1
287
by: Asha | last post by:
Dear MVP, A small question to you all Lets say I have an application which gets the value from a drop down list, e.g. GetProductInfo1(ddl.selectedItem.value) GetProductInfo2(ddl.selectedItem.value) GetProductInfo3(ddl.selectedItem.value) GetProductInfo4(ddl.selectedItem.value)
1
2118
by: digitalego | last post by:
Sorry if the title is a little confusing... Here is the problem. I am working with a "default.aspx" page that uses a user control I made: ------------------------------ | default.aspx | ------------------------------ <%@ Page language="C#" CodeBehind="ChartPage.cs"
10
1663
by: Dean Slindee | last post by:
Does anybody know to whom I can send this letter so that it hits home before Visual Studio 2005 goes production? Dear Microsoft Visual Studio 2005 developers, This is a request for you to change four of the most basic controls to improve them and make them more consistent amongst themselves.
4
1460
by: Jim | last post by:
Dear Santa, While it's true that I haven't been perfect this year, it's definitely an improvement over previous years. All cats still have their own fur, no hidden cat fur in this year's Thanksgiving green bean casserole and not even one kid in the neighborhood has lost a toe this year! With these things in mind, I'd like to ask for...
1
1707
by: Sin Jeong-hun | last post by:
I have created a simple custom control, which displays a string data on it. It draws the string at its OnPaint(). When the string is changed I can call Invalidate() to redraw the string. Sort of simple. But I guess it might not be efficient. The instances of my custom controls are on a scrollable contrainer, so if it is not in a viewable...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.