vb.net - Loop takes forever with large count -


This loop takes forever to run as a quantity of items in a Loop viewer of 1,000 and closer to 1000 , About 10 minutes. It needs to run fast for every kind of amount like 30-40 thousand.

  Add all credit records as liquid credit (list of strings) = lar.CreateLoanLines () dim as the integer = debt. If I = Last to last I = 0 for account-I, s.Append (loan (i)) other session. (Loan (i)) end if the next  

s is a stringbuilder first line there

  as the slow list (of string) = lar.CreateLoanLines ()  

only goes in a few seconds, even with thousands of records. This is a real loop which is taking some time.

How can this be adapted?

Set the initial capability of your stringbirders to a larger value (ideally, the entire final string Is similar enough to include.) Similarly:

  s = new stringbilder (loan calculation * average estimated string size)  

if you Capacity does not specify, the builder may eventually have large volumes of internal rearrangement, and it will kill performance Ega.


Comments