Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Terrible slowdown on .NET processing
Message
 
À
05/05/2006 02:25:01
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01119485
Message ID:
01119957
Vues:
16
In addition to Cetins hints, keep in mind that you are constantly re-reading a single value unnecessarily. In your scenraio you should store the value oRow["SomeField"] to a typed value then assign that.

Maybe not a big deal in this scenario since you're not looping, but in other scenerios you definitely don't want to call the row repeatedly as type conversion occurs on every single one of those row accesses.

When in a loop too it's often better to use a TableColumn as an index instead of a string. I've seen situations where using strings is 10 times slower than the TableColumn itself which is the natively stored hashvalue.


+++ Rick ---


>I just found something that I just can't find the reason. I have a terrible slowdown in one of my .NET application.
>
>If I have this:
>
>
>                        If cCurrentField = "No_Claim" Then
>                            lcHtml = lcHtml + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>"
>                        End If
>
>
>as part of a loop which is executed 200 times, it will take one second to execute the loop 200 times.
>
>But, if I have this:
>
>
>                        If cCurrentField = "No_Claim" Then
>                            lcHtml = lcHtml + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>" + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>" + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>" + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>" + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>" + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>" + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>" + "&ClaimNo=" + Trim(oRow("No_Claim")) + "&MitTelAI=" + _
>                             LTrim(Str(oRow("AI"))) + "&Hd=1>"
>                        End If
>
>
>as part of a loop which is executed 200 times, it will take 7 seconds to execute the loop 200 times.
>
>What is going on? Why is it that simply adding a longer string causes the process to crawl?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform