|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB.NET Express speed issueHi,
I've written a programme that processes stock market price data in VB.NET 2005 Express. I've optimised the code as much as possible, eg:- using arrays, not passing parameters to functions, etc... The code is slow because it is processing large amounts of data many many times. However, is there a way to compile the code to other formats to make it run faster? I've heard of C++ (too difficult for me). Does the Full Paid Version of VB.NET run code faster than the express version? Many thanks, Alex
Show quote
Hide quote
"Ali Chambers" <i***@alexchambers.co.uk> wrote in message No it's the same. If you post a simple sample program that illustrates your news:1155738324.628507.280190@h48g2000cwc.googlegroups.com... > Hi, > > I've written a programme that processes stock market price data in > VB.NET 2005 Express. I've optimised the code as much as possible, eg:- > using arrays, not passing parameters to functions, etc... > > The code is slow because it is processing large amounts of data many > many times. > > However, is there a way to compile the code to other formats to make it > run faster? I've heard of C++ (too difficult for me). > > Does the Full Paid Version of VB.NET run code faster than the express > version? performance problem you're likely to get some advice. David Ali Chambers wrote:
> I've written a programme that processes stock market price data in Why would you think that passing parameters to functions would result> VB.NET 2005 Express. I've optimised the code as much as possible, eg:- > using arrays, not passing parameters to functions, etc... in any appreciable performance loss? > You say the code is slow, how did you measure this? What is the size> The code is slow because it is processing large amounts of data many > many times. > of the data you are processing and how long does it take? How long do you think it *should* take? What is your basis for comparison? According to the 80/20 rule, the program spends 80% of the time in only 20% of the code. That 20% of the code is what should be measured first and then the remaining code as needed. I suggest getting a code profiler and finding out where the bottlenecks actually lie and start your investigation there. Since .Net intermediate code is JIT compiled into native machine code, it should not run any slower than other code. Good Luck Ali,
In addition to the others, I think that we are special intereste in that array part, because using real array's slows down often the process. All managed code program language from Microsoft create the same end code in every versie and run all at the same speed. Cor Show quoteHide quote "Ali Chambers" <i***@alexchambers.co.uk> schreef in bericht news:1155738324.628507.280190@h48g2000cwc.googlegroups.com... > Hi, > > I've written a programme that processes stock market price data in > VB.NET 2005 Express. I've optimised the code as much as possible, eg:- > using arrays, not passing parameters to functions, etc... > > The code is slow because it is processing large amounts of data many > many times. > > However, is there a way to compile the code to other formats to make it > run faster? I've heard of C++ (too difficult for me). > > Does the Full Paid Version of VB.NET run code faster than the express > version? > > Many thanks, > Alex > Thanks for your help. I appreciate the programme may take a long time
to run whatever the language. I wondered: a) If MS didn't allow "fast code optimisation" in VB Express - ie. force you to buy full product to get true speed realisation b) The code is as follows: - Price data is held in "double" floating point array, eg:- highprice(0-9999) - Comparisons are done between highprice(0-9999) and lowprice(0-9999) - Buy levels are determined and these buy points held in arrays - The programme then loops through the price arrays incrementally to find sell prices - at which it sells and records the price (a basic description!) Different levels for buy & selling are tested (too complicated for this email). On average, the buy/sell routine is called 3 million times per stock. c) Are there third party products to speed up the code? d) Or - off topic - would another language be better? Sorry - basic questions - but I'm a novice coder. Alex Looks rather you should review how you proceed (for example the "looping in
an array to find" would make me think an arrayb is not the suitable data structurss for this particular part)... etc... -- Patrice "Ali Chambers" <i***@alexchambers.co.uk> a écrit dans le message de news: 1155744811.429264.164***@i3g2000cwc.googlegroups.com...Show quoteHide quote > Thanks for your help. I appreciate the programme may take a long time > to run whatever the language. > > I wondered: > > a) If MS didn't allow "fast code optimisation" in VB Express - ie. > force you to buy full product to get true speed realisation > > b) The code is as follows: > > - Price data is held in "double" floating point array, eg:- > highprice(0-9999) > - Comparisons are done between highprice(0-9999) and lowprice(0-9999) > - Buy levels are determined and these buy points held in arrays > - The programme then loops through the price arrays incrementally to > find sell prices - at which it sells and records the price (a basic > description!) > > Different levels for buy & selling are tested (too complicated for this > email). On average, the buy/sell routine is called 3 million times per > stock. > > c) Are there third party products to speed up the code? > > d) Or - off topic - would another language be better? > > Sorry - basic questions - but I'm a novice coder. > > Alex > Sounds to me like you need to store this information in a database and
instead or incrementing through your array to match a specific value, you should just select it from among 3 million records. Ali Chambers wrote: Show quoteHide quote > Patrice - so what would you suggest then? I would suggest a Hashtable or a database
if you really want to do everything in memory then a hashtable is the fastest option why is a hashtable faster as a "normall" array ( in fact is a hashtable a special kind of array , same for collections and even datarows etc etc ) see this : http://en.wikipedia.org/wiki/Hash_table regards Michel Posseth [MCP] Show quoteHide quote "Ali Chambers" <i***@alexchambers.co.uk> schreef in bericht news:1155746373.684860.16320@75g2000cwc.googlegroups.com... > Patrice - so what would you suggest then? > If you are using ReDim to resize your array when data is added, this is
extremely slow! -- Show quoteHide quoteDennis in Houston "Ali Chambers" wrote: > Patrice - so what would you suggest then? > > Ali,
I said already Arrays are extremely slow to handle at least you can have a look at the list classes from which the arraylist is the most simple one. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionsarraylistclasstopic.asp But there are more advices given including that what you are asking now, because your reaction I have the idea that you did read nothing of those.. Cor Show quoteHide quote "Ali Chambers" <i***@alexchambers.co.uk> schreef in bericht news:1155744811.429264.164460@i3g2000cwc.googlegroups.com... > Thanks for your help. I appreciate the programme may take a long time > to run whatever the language. > > I wondered: > > a) If MS didn't allow "fast code optimisation" in VB Express - ie. > force you to buy full product to get true speed realisation > > b) The code is as follows: > > - Price data is held in "double" floating point array, eg:- > highprice(0-9999) > - Comparisons are done between highprice(0-9999) and lowprice(0-9999) > - Buy levels are determined and these buy points held in arrays > - The programme then loops through the price arrays incrementally to > find sell prices - at which it sells and records the price (a basic > description!) > > Different levels for buy & selling are tested (too complicated for this > email). On average, the buy/sell routine is called 3 million times per > stock. > > c) Are there third party products to speed up the code? > > d) Or - off topic - would another language be better? > > Sorry - basic questions - but I'm a novice coder. > > Alex >
To overload, or not to overload?
ANN: VS.NET 2003 SP1 Memory Usange In VB.NET Capturing the second column data from a list view box. Serial Port Communuciation in VB with Compact Framework 2.0 create a folder useing vb code? Control.Visble = True ERROR Automaticaly Clicking a Checkbox on a webbrowser control hyperlink text DateTime.ParseExact(..) |
|||||||||||||||||||||||