C# - Comments Slow Down The Execution Time Of Webpages?

Nov 5, 2010

This might be a pretty strange question in the eyes of some of you out here, but I really wonder if comments in my code will slow down the execution time of the pages I make.I have some Classes / WebControls that required alot of comments to make everything clear and quickly readable to other people that will have to deal with my code and now wonder how ASP.Net deals with my comments. Will comments be stripped from my code at compile time or how is this all done?I should be more specific: I mean comments in my code-behind in C#.

View 4 Replies


Similar Messages:

C# - WebMethod() Is Slow On Each Execution Compared To After Run It As A Windows Application

Mar 11, 2011

I have developed an application that interacts with IBM ClearQuest. The problem is that when I run everything locally, such as, run the webservice local and then ASP page local everything is at the speed I expect. When I post the webservice (precompiled) to the server and run the web page through the server, the call to the webmethod takes at least 10x the amount of time it should. I dont know why this is happening. I made a console application that has the function in question and execute it on the server and locally and they both return the same amounts of time (roughly) its just when I move to executing via the webmethod everything grinds to a snails pace. Any ideas? This happens every time not just on the first call.

WebMethod:

Public Function RetrieveQueryResults(ByRef cqSession As ClearQuestOleServer.Session, _
ByVal sqlStmt As String) As List(Of SearchResultsSingleIssue)
Dim numCols As Integer, status As Integer, columnIdx As Integer
Dim numRows As Integer
Dim rowContents As String = ""
Dim colValue As New Object
Dim colLabel As New Object
Dim allitems As New List(Of SearchResultsSingleIssue)
Dim results As New SearchResultsSingleIssue
Dim cqResultSet As ClearQuestOleServer.OAdResultset
cqResultSet = cqSession.BuildSQLQuery(sqlStmt)
cqResultSet.Execute()
' Get the number of columns returned by the query.
numRows = 0
numCols = cqResultSet.GetNumberOfColumns
status = cqResultSet.MoveNext
' Collect query results.
Do While status = AD_SUCCESS
results = New SearchResultsSingleIssue
numRows = numRows + 1
For columnIdx = 1 To numCols
colLabel = cqResultSet.GetColumnLabel(columnIdx)
colValue = cqResultSet.GetColumnValue(columnIdx)
'Make sure that we dont pass along a null reference
If colValue = Nothing Then
colValue = ""
End If
Select Case colLabel
Case "ID"
results.IssueID = colValue
Case "HEADLINE"
results.Headline = colValue
Case "NAME"
results.State = colValue
Case "OE_CONTACT"
results.OEContact = colValue
Case "DESCRIPTION"
results.Further_Description = colValue
Case "PRODUCT_NAME"
results.Product_Name = colValue
Case "FUNCTIONAL_AREA"
results.Functional_Area = colValue
Case "SUBTOPIC"
results.Subtopic = colValue
Case "FOUND_VERSION"
results.Found_In = colValue
Case "SCHEDULED_VERSION"
results.Scheduled_For = colValue
Case "SYMPTOMS"
results.Symptoms = colValue
Case "AFFECTED_SYSTEMS"
results.Affected_System_Types = colValue
Case "ISSUE_TYPE"
results.Issue_Type = colValue
Case "ASSIGNED_TO"
results.Assigned_Developer = colValue
Case "TESTED_BY"
results.Assigned_Tester = colValue
Case "BUILT_VERSION"
results.Built_In = colValue
Case "TESTED_VERSION"
results.Tested_In = colValue
Case "NOTES_LOG"
results.Notes_Log = colValue
Case "CUSTOMER_SEVERITY"
results.Severity = colValue
Case "PRIORITY"
results.Priority = colValue
End Select
Next columnIdx
' Add the query row result to the compiled list of all rows.
allitems.Add(results)
status = cqResultSet.MoveNext
Loop
Return allitems
End Function

Local Windows Application Method:

private void button2_Click(object sender, EventArgs e)
{
start = DateTime.Now.TimeOfDay.Seconds;

int numCols = 0;
int status = 0;
int columnIdx = 0;
int numRows = 0;
string rowContents = "";
string colValue;
string colLabel;
List<SearchResultsSingleIssue> allitems = new List<SearchResultsSingleIssue>();
SearchResultsSingleIssue results = new SearchResultsSingleIssue();
ClearQuestOleServer.OAdResultset cqResultSet = default(ClearQuestOleServer.OAdResultset);
cqResultSet = (ClearQuestOleServer.OAdResultset)ClearQuestSession.BuildSQLQuery(sqlStatement);
cqResultSet.Execute();
// Get the number of columns returned by the query.
numRows = 0;
numCols = cqResultSet.GetNumberOfColumns();
status = cqResultSet.MoveNext();
// Collect query results.
while (status == 1)
{
results = new SearchResultsSingleIssue();
numRows = numRows + 1;
for (columnIdx = 1; columnIdx <= numCols; columnIdx++)
{
colLabel = (string)cqResultSet.GetColumnLabel(columnIdx);
colValue = (string)cqResultSet.GetColumnValue(columnIdx);
//Make sure that we dont pass along a null reference
if (colValue == null)
{
colValue = "";
}
switch (colLabel)
{
case "ID":
results.IssueID = colValue;
break;
case "HEADLINE":
results.Headline = colValue;
break;
case "NAME":
results.State = colValue;
break;
case "OE_CONTACT":
results.OEContact = colValue;
break;
case "DESCRIPTION":
results.Further_Description = colValue;
break;
case "PRODUCT_NAME":
results.Product_Name = colValue;
break;
case "FUNCTIONAL_AREA":
results.Functional_Area = colValue;
break;
case "SUBTOPIC":
results.Subtopic = colValue;
break;
case "FOUND_VERSION":
results.Found_In = colValue;
break;
case "SCHEDULED_VERSION":
results.Scheduled_For = colValue;
break;
case "SYMPTOMS":
results.Symptoms = colValue;
break;
case "AFFECTED_SYSTEMS":
results.Affected_System_Types = colValue;
break;
case "ISSUE_TYPE":
results.Issue_Type = colValue;
break;
case "ASSIGNED_TO":
results.Assigned_Developer = colValue;
break;
case "TESTED_BY":
results.Assigned_Tester = colValue;
break;
case "BUILT_VERSION":
results.Built_In = colValue;
break;
case "TESTED_VERSION":
results.Tested_In = colValue;
break;
case "NOTES_LOG":
results.Notes_Log = colValue;
break;
case "CUSTOMER_SEVERITY":
results.Severity = colValue;
break;
case "PRIORITY":
results.Priority = colValue;
break;
}
}
// Add the query row result to the compiled list of all rows.
allitems.Add(results);
status = cqResultSet.MoveNext();
}
seconds = (DateTime.Now.TimeOfDay.Seconds - start);
label3.Text = seconds.ToString();
}

The code should execute in about...6 seconds.

View 1 Replies

Web Forms :: When Published And As Well As During Development, The Execution Speed Of Page Is Very Slow?

Apr 21, 2010

i have developed an ERP in asp.net 3.5. The problem is that when published and as well as during development, the execution speed of page is very slow. I have off the compilation mode in web.config and also get all the data in page load and then filter it using Dataview rowfilter property but i can't get much better speed.

View 5 Replies

Social Networking :: Display Facebook Comments And Allow User To Post Comments To Wall

May 7, 2013

How user post comment on my website  using gmail ,fb,yahoo ,hotmail account ...

how to apply this.. [URL] ....

View 1 Replies

Different Execution Time For Same Query - SQL Server?

Jan 28, 2011

I have a query:

Select a from tbl_abc where id in ( select id from tbl_xyz where mainid = 12)

When I am executing this query, it is taking 1-2 seconds to execute, but when I am using the same query in stored procedure, the below query is taking more than 5 minute:

If(Select a from tbl_abc where id in ( select id from tbl_xyz where mainid = 12))
BEGIN
-- CREATE TEMPORARY TABLE [Say: #temp1]
#temp1 => Select a from tbl_abc where id in ( select id from tbl_xyz where mainid = 12)
inserting the same value in the temp table
drop #temp1
END

what could be the reason of this? and how can I resolve this? I am running the SP from asp.net

View 3 Replies

How To Measure The Execution Time Of A Webpage

Jul 28, 2010

I would like to check how long an ASP.NET page takes to execute (server stuff obviously, not interested in how long it takes to throw the results down the line and for the browser to render them at this stage).

Having done some searching, I came across http:[URL] which shows how to do just this. Trouble is, it doesn't work for me. I copied the code exactly, but the execution time is always zero.

I tried enabling tracing, and that showed an elapsed time between Page_Init and Page_PreRender, but the values returned by Environment.TickCount were exactly the same in both events, so the elapsed time was 9obviously) zero.

View 9 Replies

Configuration :: How To Increase The Execution Time

Sep 10, 2010

How to increase the execution time?

View 11 Replies

Databases :: How To Get Query Execution Time

Sep 2, 2010

I need to find out the query execution time from the front end .Where should I insert the code for that.

I am using the bleow query:

OracleConnection con = new
OracleConnection(ConnStr);
con.Open();
OracleCommand cmd =
new
OracleCommand("Stored_Proc",con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add();
....................
................
OracleDataAdapter
oda = new
OracleDataAdapter
(cmd);

View 2 Replies

C# - Calling SqlCommand Execution Time Is Increasing?

Jul 9, 2010

I've got a loop that executes the stored procedure in a loop with over 40,000 iterations, like so:

SqlCommand command = new SqlCommand("WriteDataToDB");
command.Connection = _connection;
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@SignalID", SqlDbType.Int).Value = Arg_Signal.SignalID;
command.Parameters.Add("@SignalStrength", SqlDbType.Float).Value = Arg_Signal.SignalSiggestion;
command.Parameters.Add("@Time", SqlDbType.BigInt).Value = Arg_Signal.TimeWasHit;
command.Parameters.Add("@Value", SqlDbType.Float).Value = Arg_Signal.ValueWasHit;
if (command.Connection.State != ConnectionState.Open)
{
command.Connection.Open();
}
command.ExecuteNonQuery();

This code is called from a loop where I intercept and time every 1000th iteration. The times I get are below:

[0]: "Started 0ms"
[1]: "1000 done 578.125ms"
[2]: "1000 done 921.875ms"
[3]: "1000 done 1328.125m"
[4]: "1000 done 1734.375ms"
[5]: "1000 done 1140.625ms"
[6]: "1000 done 1250ms"
[7]: "1000 done 1703.125ms"
[8]: "1000 done 1718.75ms"...........................

View 3 Replies

Page Lifecycle - Capturing Server Execution Time Without Network Latency?

Nov 19, 2010

I need to capture the amount of time that ASP.net takes to execute each page request in my application, but I need to exclude any network latency. I am currently capturing render times by using the StopWatch class and starting the stopwatch during the OnInit method of the page lifecycle and stopping it after the Unload method completes. It seems that the Unload method includes the time it takes send the request to the client, thus including any internet/network latency. What is the last possible point I could stop the stopwatch in the Page Life Cycle that would not include the time it takes to send the request to the client. Would it be directly before the Unload event?

Related question: Does ASP.net finish building the response before it starts sending to the client? Or does it start sending asynchronously, while the response is being formed?

I am using ASP.Net 2.0 with IIS 5 currently.

I have this code in a class that all of my pages inherit from:

readonly Stopwatch _serverExecutionTime = new Stopwatch();
protected override void OnInit(EventArgs e)
{
_serverExecutionTime.Start();
base.OnInit(e);
}
protected override void OnUnload(EventArgs e)
{
_serverExecutionTime.Stop();
base.OnUnload(e);
}

UPDATE

I tried capturing the execution time at the end of the OnRender method, at the start of the OnUnload method and at the end of the OnUnload method. In all three cases the difference in times was at most 1 millisecond. Even when testing this from a client in Europe to a server in the USA, the times were identical.

View 3 Replies

Dll - How To Slow The First Time After Building A Class Library

Jun 10, 2010

I've got a web app solution containing a class library project.

Whenever I rebuild the class library and then refresh the page, it takes ages the first time, and is then quick again subsequently.

It's almost as if the newly rebuilt dll is having to 'bed in' to the app.

View 3 Replies

After Multiple User Login / Some Time C# Application Get Slow

Jul 2, 2010

In application all sql connection close properly, Also when user log out its connection close still sql process memory increase in RAM and after some time Application slow down.

View 3 Replies

C# - Telerik RadAjaxManager Loads Controls Slow The First Time?

Mar 15, 2011

So I have a RadPanelBar, and within that a RadTreeView. On a node click event I want so update some control.. for now I am just trying to update a textbox. It works fine except that the first time I click on a child node it takes a very long time to update the control.. Just a simple text change. I set a break point in my function and I noticed that it is taking long to fire the OnNodeClick event.. If I click a parent node in the tree view it loads fine on the first click. Also, after the first time I've clicked it.. it loads quickly.. If I refresh the page, it is slow on the first click again.. Is there something I am missing.. Is the structure of my HTML inappropriate for these AJAX calls? I feel like this is a really simple example that should work..

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="IncidentReportPanel">

[Code]....

EDIT: I updated my code according to this article, [URL] , and the problem persisted... again it only happens the first time..

EDIT: Just to clarify, by updating according to that article, I mean that I removed all the tables and relative widths and replaced them with css positioning and fixed widths.. the problem only happens the first time.. and it only happens sometimes.. quite a few times i thought i solved the problem as it would start responding quickly.. but then after I change my .aspx and change it back (even to the exact same thing when it was working quickly).. I get the same problem..

EDIT: So, I removed the AJAX component.. and setup the control so that it does a PostBack.. and it still takes long to hit my break point.. so it seems that its not an AJAX issue... but for some reason my events are taking long to fire..

EDIT: So I followed the advice on this post and I used the webservices to do my binding and handle everything from the client side code.. All seemed to be ok until I decided that I wanted to return nodes from my webservice that could also be expanded.. So in my webservice I set the ExpandMode of my RadTreeNodeData object to Webservice.. and it renders the data correctly when I expand the child nodes.. However now I see the same problem from before where some calls take 20-30 seconds.. It takes 20-30 seconds to even hit the break point in my webservice.. Should I use the OnClientNodeExpand event instead?

View 3 Replies

Installation :: Web Page Slow To Start After A Short Period Of Time

Feb 5, 2011

My web site seems to be running quick. I have not deployed my web site yet, so I am the only one using it right now. The problem I have is if I am testing out the site and then I stop using it for a short period of time, when I come back the web site takes about 8-10 seconds to startup again. I did not rebuild the site I just simply stopped using it for a short period of time. It seems like after a short period of time I have to 'wake it up' again. Is this normal? How can I prevent this?

View 2 Replies

Configuration :: Slow Load Time After Updating Class In App_Code?

Dec 20, 2010

We have an asp.net website running on IIS 6 Windows 2003. When ever we upload a class file to the App_Code folder our whole site goes down temporarily until, what I assume, compilation is complete. Has anyone else experienced this? Any other file we upload it does not do this only our class files.

View 1 Replies

V4.0 IIS 7.0 Integrated Slow / Certain Pages And It Seems To Compile Again Next Time Go That Page Its Very Fast?

Feb 24, 2011

We recently migrated to v4 of .net. We are running iis 7 in integrated mode. When the site first starts its slow. I get that - it compiles for the first time. The odd thing is then we will go to certain pages and it seems to compile again. The next time i go that page its very fast. Nothing exceptional with the second page - but once that is hit the rest of the site is fast.

View 1 Replies

Can Large External JavaScript Files Slow Down The Page Load Time

Aug 4, 2010

When we include Javascript files in our aspx files. either we write all the Javascript code in the Head section of aspx or we link to an external Javascript file.

So when the clinet makes a call to that page. Does that mean that all the Javascript will be loaded on the client side?

If that is the case then does not that mean that it will slow down the loading of page as all the Javascript has to be loaded on the client machine?

View 3 Replies

Editing Web.config Comments

Sep 30, 2010

I have this

Code:

<httpRuntime maxRequestLength="10240" executionTimeout="120"/>

in the web.config file of an application - so that file uploads of 10mb are allowed. The default - shown in the web.config.comments file - is 4096 or 4mb Today a user uploaded a file that was 4.55 mb and the app fell over. The server event log shows this warning:Post size exceeded allowed limits About 10 minutes later another email was sent with a 3.33 mb attachment. Again, it fell over and this time the server event log shows:

HttpException ... Request timed out

As it happens, on both occasions the files were uploaded to the server correctly and all the emails got sent - according to log files on the Exchange server. So, what happened? I figure I'll increase the file upload and timeout in the web.config file. Should I also increase the file upload in the web.config.comments file that affects the whole server? How do you edit the web.config.comments file? Just open it in Notepad, make the changes and save?

View 2 Replies

Comments Forum In A Web Page

Oct 10, 2010

i have this forum page on my website. I want when users leave comment, the old comments should be at the bottom and new comments at the top. The code for that is below:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
DeleteCommand="DELETE FROM [forum] WHERE [Postingid] = @Postingid"
InsertCommand="INSERT INTO [forum] ([UserName], [TheDateTime], [Subject], [Message]) VALUES (@UserName, @TheDateTime, @Subject, @Message)"
SelectCommand="SELECT * FROM [forum] "
UpdateCommand="UPDATE [forum] SET [UserName] = @UserName, [TheDateTime] = @TheDateTime, [Subject] = @Subject, [Message] = @Message WHERE [Postingid] = @Postingid">
<DeleteParameters>
<asp:Parameter Name="Postingid" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="TheDateTime" Type="String" />
<asp:Parameter Name="Subject" Type="String" />
<asp:Parameter Name="Message" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="TheDateTime" Type="String" />
<asp:Parameter Name="Subject" Type="String" />
<asp:Parameter Name="Message" Type="String" />
<asp:Parameter Name="Postingid" Type="Int32" />...........................

View 1 Replies

SQL Command For Recent Blog Comments

Jul 22, 2010

I have a BlogPost table by which i post blog on my website, this is the structure of BlogPost Table:

BlogPostID int Unchecked
LanguageID int Unchecked
BlogPostTitle nvarchar(200) Unchecked
BlogPostBody nvarchar(MAX) Unchecked
BlogPostAllowComments bit Unchecked
CreatedByID int Unchecked
CreatedOn datetime Unchecked
[code]...

View 13 Replies

How To Post Comments In Blog Style

Mar 25, 2010

I am working on a project. I need to allow user to comment on pictures - like a blog. For example, if you like a picture, you post your comment on the pictures and say why you like. When the user type a comment in the text box, how do I put it under the pictures? Also, if two people were to post comments, how do I know where the first comment ends and where to start posting the second comments? Also, how do I know when the page is full and start a new page?

View 6 Replies

Javascript - Adding Comments Like Facebook With C#?

Jan 19, 2011

I'm developing an blog using ASP.NET, and I want that the user can be able to add comments.

So I want to implement the of facebook on adding comments.

The comment will be stored in the database, so I will be able to load it with the page if the user goes to another web page.

how can I do this thing ( Ajax, Javascript, jQuery, Ajax Toolkit ) ?

EDIT:

I found this :

<body>
<form id="form1" runat="server">
<p>
<textarea id="textArea">

View 2 Replies

MVC :: Details & Comments Post On Same Page

Nov 11, 2010

I have a details page, which lists the selected Restaurant. I want to be able to add comments at the bottom and display them. I have managed to add comments but only on a different page, i am struggling to get both the datails and the Comment create on the same form. This is what i have:

Controller
[Code]....

View Model
[Code]....

View
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BestRestaurant.ViewModels.RestaurantDetailsViewModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Details</h2>
<fieldset>
<legend>Fields</legend>
<div>R_ID</div>
<div><%: Model.Restaurant.R_ID%></div>
<div>R_Name</div>
<div><%: Model.Restaurant.R_Name %></div>....................

View 1 Replies

Security :: Get Membership User Comments?

Apr 26, 2010

I'm trying to get the comments section for a user, to populate a text box which can be updated. I'm getting the "Object reference not set to an instance of an object" error. Why is this occurring?

[Code]....

View 2 Replies

Best Way To Attach Blog Post Comments?

Mar 15, 2011

I have a blog page that has 20 posts each page.I'm using Listview for displaying posts. If I want to display comments for each posts, what would be the best way? My database stracture is as follow

-blog (table)
-blogID, postContents (fields)
-blogComments (table)

-blogcommentID, blogID, comments (fields)

Since I have many comments for each posts, I don't think I can join table.Only thing I can think of is that I can use DataReader and loop through the results in Listview Databound events.What would be the best way to achieve this?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved