Folks:
I did some crude benchmarks (moving around arrays of integers, generating random numbers w/ .Next() and .NextDouble(), no I/O) and found that for visual express beta 2, my c++ and c# code were much slower than my python code (w/ psyco). I cannot believe this is true, but it may be there are issues with the beta and compiler options that I'm being stupid about. I did (for c++) use the release option -- is there anything else going on here that I should know about
Thanks for any help.
sd

crude benchmarks
_ _
I assume that using the same calls in c# is what is causing the slowdown.
Things brings up a general point. There aren't (so far as I can find on google) open source / free numeric libraries for c#. One can redo algorithms from numerical recipes, but that's a pain. The math support seems slim, and for research, having a library like scipy / numarray is really helpful.
Thanks for the advice; I'm glad I found the problem.
sd
eduboys
You also have to realize that although C# might not be faster than Python at some operations, it makes up for it via the increase in productiveness through the use of .NET Framework class libraries.
Also, you could be missing out on some C++ optimizations by using the Express edition. I don't believe that you have as much control as you do with the full version of Visual Studio.
KevinUT
Otherwise, I DID use a computational model from my "real work" -- I'm shocked python is faster. It seems given the obvious traits of the language, it should not be.
best
sd
Beav1810
There are some options for math libraries, it really depends on what you're looking for.
For finance, Visual Numerics has a set of libraries for C# that they recently announced.
http://www.vni.com/company/press/cSharpRelease.html
There are others as well that we've found and made available on the C# Developer Center at http://msdn.microsoft.com/vcsharp/downloads/samples/libraries/. I've copy/pasted the math libraries below. Lutz Roeder's MaPack.NET is free and includes source and probably the closest to what you're looking for.
Extreme Optimization Mathematics Library for .NET includes classes for complex numbers, curves, solving equations, numerical integration, numerical differentiation, vectors, matrices, and various special functions.
Mapack is a .NET class library for basic linear algebra computations. It supports the following matrix operations and properties: Multiplication, Addition, Subtraction, Determinant, Norm1, Norm2, Frobenius Norm, Infinity Norm, Rank, Condition, Trace, Cholesky, LU, QR, Single Value decomposition, Least Squares solver, Eigenproblem solver, Equation System solver. The algorithms were adapted from Mapack for COM, Lapack and the Java Matrix Package.
The NMath product suite from CenterSpace Software provides building blocks for mathematical, financial, engineering, and scientific applications on the .NET platform. Features include matrix and vector classes, random number generators, statistical functions, numerical integration methods, and object-oriented interfaces to public domain computing packages such as the BLAS (Basic Linear Algebra Subprograms) and LAPACK (Linear Algebra PACKage).
Math.NET is a framework written in C# for performing symbolic mathematical operations in an object oriented way.
Thanks,
Dan Fernandez
C# Product Manager
TechCzech
I'd be quite surprised if the equivelant Python code was noticeably faster than the C++ or C# code. In general, any non-rigorous performance testing can show wildly varying results based on particular usage patterns and environmental factors.
Do you have a small sample that you could post with the 3 versions of the code and the methodology you used for your testing I'd be interested to see whether we can find the particular piece of functionality that is causing the performance problems you are seeing.
Thanks,
Luke Hoban
Visual C# IDE Program Manager