[ask] how to make it faster???

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2008
Posts: 8
Reputation: allopiloping is an unknown quantity at this point 
Solved Threads: 0
allopiloping allopiloping is offline Offline
Newbie Poster

[ask] how to make it faster???

 
0
  #1
Jun 13th, 2008
dear guys...
i have a code but it runs so slowly
i would it to make it fast...can u help me??

what should i do???

  1. Var2 = 0.1
  2. For y = 0 To jlhPro - 1
  3. Do
  4. Var1 = Var2
  5.  
  6. For z = 0 To thn - 1
  7. kata &= data(y, z) & "*" & Var1 & "^" & z + 1 & vbCrLf
  8. Res1 += data(y, z) * Var1 ^ (z + 1)
  9. kata &= "data = " & data(y, z) & vbCrLf
  10. kata &= "res1 = " & Res1 & vbCrLf
  11. Next
  12. Res1 -= invest
  13. kata &= "res1 = " & Res1 & vbCrLf & vbCrLf & vbCrLf
  14. kata &= "=========================================" & vbCrLf
  15.  
  16.  
  17. For z = thn To 1 Step -1
  18. Res2 += z * data(y, z - 1) * Var1 ^ (z - 1) & vbCrLf
  19. kata &= z & "*" & data(y, z - 1) & "*" & Var1 & "^" & (z - 1) & vbCrLf
  20. kata &= "res2 = " & Res2 & vbCrLf
  21. Next
  22.  
  23. Var2 = Var1 - Res1 / Res2
  24. Loop Until Math.Abs(Var1 - Var2) < 0.00000001
  25.  
  26. ir = (1 - Var2) / Var2
  27. kata &= "irr = " & ir * 100 & "% " & vbCrLf
  28. Next
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 22
Reputation: dadelsen is an unknown quantity at this point 
Solved Threads: 5
dadelsen dadelsen is offline Offline
Newbie Poster

Re: [ask] how to make it faster???

 
0
  #2
Jun 14th, 2008
I did not analyze the algorithm. Concerning the types that are used:
If a program needs to perform many append operations on a string, using a stringbuilder object may be faster than using a string object.

See
http://msdn.microsoft.com/en-us/libr...er(VS.80).aspx
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum


Views: 446 | Replies: 1
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC