Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

I have an API that for an order routing platform that is in visual basic. The maximum frequency or orders to exchanges will be milliseconds, where the underlying systems are expected to be able to process a maximum of 1 order per millisecond.

Generally I would like to write in C++ or Java when I have this level of speed in mind, and have a broad stigma against visual basic for being inherently slower.

But since 1 millisecond is a long time in computer time, is visual basic still fast enough?

The algorithm will be reading information from the exchanges, crunching a few numbers and determining an order to send back to the exchanges.

I am estimating latency of 120 milliseconds, 1 millisecond to do the computational math, and then another 120 milliseconds back to the exchange. or less of course, but I know where the computers are geographically and this is about how long it should take.

I would like to keep the computational time at 1 millisecond, this isn't really a stretch for visual basic on a modern computer correct? (the local machine won't be doing much processing, as it will be fed most relevant data from the clearing firms data feeds)

share|improve this question
    
This question is likely too open ended. I am sure the people who can answer you best need to know more about the type of calculations, etc you're doing... –  NoviceCoding Feb 8 '12 at 3:24
4  
Unless you're trying to pairs trade across the Atlantic, with a 120ms latency I honestly wouldn't worry too much about sacrificing 1 or 2ms on computation. You won't be even close to being competitive on speed, so you may want to focus on strategies that work within that frequency space. –  emsfeld Feb 8 '12 at 17:01
    
emsfeld, I'm not going for high frequency trades, and ideally the brokerdealer and clearing firm were located geographically closer, but this is the estimation I have thanks! –  CQM Feb 8 '12 at 20:29
    
Short answer: yes. I am doing it all day long. Or better: VB is doing it... –  user1194505 Feb 10 '12 at 8:53

5 Answers 5

up vote 10 down vote accepted

All .NET languages are perfectly able to compete with the speed of C and even FORTRAN. It all depends on if they are used the correct way.

1) Both Java and .NET have considerable longer startup times than most native app. Therefore, you will have to have the application running and not starting it over and over on request.

2) Memory management is crucial when using managed heaps and if you are in need of reliable peak performance. Make sure, not to allocate large arrays over and over, since this will stress the GC too much and produce larger latencies.

3) Consider using optimized libraries. Some are around for C#/Visual Basic (ILNumerics) and Java (f.e. jblas). Recent tests have shown very good performance for numeric managed algorithms compared to native implementations and other frameworks.

4) Test your implementation and profile it! If you are positive, you could reach the performance goal with a C implementation, you can reach it with .NET as well.

share|improve this answer
    
I didn't realize this "All .NET languages are perfectly able to compete with the speed of C and even FORTRAN." thanks! –  CQM Feb 9 '12 at 15:34
    
@user492238 Regarding 2): if I cannot use large arrays, I cannto use .NET!? –  user1194505 Feb 10 '12 at 8:55
1  
+1 for the ILnumeric link (if I could ... ;) –  user1194505 Feb 10 '12 at 8:57
1  
@user1194505 You should REuse them. Pooling is more efficient than REallocating. Especially for large(st) arrays. –  user492238 Feb 10 '12 at 9:03
    
@user492238 thanks. I misunderstood your point and agree to 100% –  user1194505 Feb 10 '12 at 21:04

The only way to find out is to try it!

It shouldn't take very long to write some simple code to simulate the computations you plan to do, and run it in a loop.

With current versions of Visual Basic (VB.net), performance should be comparable to Java in most cases because the basic technology (compiling to intermediate code and then running a just-in-time compiler) are roughly the same.

Performance in C or C++ may be faster. Then again, it may not. The only way to find out is to try!

share|improve this answer
3  
+1 This is the only legitimate answer to a question of is X fast enough. Only the OP can answer that. –  chrisaycock Feb 8 '12 at 14:00

From the computational (math) prespective, VB.net should be able to compete with Java and C/C++. The only possible problem can be the garbage collection (as in Java). Therefore don't forget to set server-type garbage collector and carefully organize/manage your data structures.

share|improve this answer
    
What would server gc help for? –  user492238 Feb 8 '12 at 22:59

Short answer: Yes. I am using it frequently.

The stigma regarding Visual Basic comes from the time, where VB5 was COM based with some dirty language quirks. This time, VB was intended for/ to be used within / in conjunction with Office' macros. .NET substantially changed the technology behind the language as well as removed most 'quirks' regarding usability. It is now on par with C# and all other .NET languages regarding execution speed.

share|improve this answer

VBA is not useful for complex algorithms, in the sense that 1) coding is not efficient and 2) it has its limitations in terms of available resources on the net. You need to take into account that there are already a large number of institutions active in the high frequency segment, which means that they are your competitors. In order to ensure proper models (and to be faster than they are) you need to have excellent and efficient codes (COMPLEX!) optimized with the input of computer specialists. VBA is therefore a too simple language.

share|improve this answer
    
VBA is not VB.NET. It's unlikely the OP is asking about VBA –  user508 Apr 14 '12 at 0:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.