Home All Groups Group Topic Archive Search About

VB.NET Express speed issue

Author
16 Aug 2006 2:25 PM
Ali Chambers
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

Author
16 Aug 2006 2:30 PM
David Browne
Show quote Hide quote
"Ali Chambers" <i***@alexchambers.co.uk> wrote in message
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?

No it's the same.  If you post a simple sample program that illustrates your
performance problem you're likely to get some advice.

David
Author
16 Aug 2006 2:42 PM
Chris Dunaway
Ali Chambers wrote:

> 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...

Why would you think that passing parameters to functions would result
in any appreciable performance loss?

>
> The code is slow because it is processing large amounts of data many
> many times.
>

You say the code is slow, how did you measure this?  What is the size
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
Author
16 Aug 2006 3:55 PM
Cor Ligthert [MVP]
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
>
Author
16 Aug 2006 4:13 PM
Ali Chambers
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
Author
16 Aug 2006 4:32 PM
Patrice
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
>
Author
16 Aug 2006 4:39 PM
Ali Chambers
Patrice - so what would you suggest then?
Author
16 Aug 2006 4:51 PM
Izzy
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?
Author
16 Aug 2006 5:22 PM
Michel Posseth [MCP]
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?
>
Author
16 Aug 2006 11:28 PM
Dennis
If you are using ReDim to resize your array when data is added, this is
extremely slow!
--
Dennis in Houston


Show quoteHide quote
"Ali Chambers" wrote:

> Patrice - so what would you suggest then?
>
>
Author
16 Aug 2006 5:03 PM
Cor Ligthert [MVP]
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
>