forum.alglib.net
http://forum.alglib.net/

C# performance
http://forum.alglib.net/viewtopic.php?f=2&t=765
Page 1 of 1

Author:  Stabilitronas [ Tue Jan 29, 2013 9:08 pm ]
Post subject:  C# performance

I've scanned the forum twice, but still could not find information of how C++ and C# versions of alglib compares. I remember somebody stating "C# is several times slower", but now couldn't find that post. Is C# version fully implemented in managed code, or there are some native routines used?

Currently, I use C# minlm package to fit a function, and it takes me ~2.5ms. If I compile C++ version to a dll, make a wrapper (or something) to invoke from C#, will I get better results?

Author:  Sergey.Bochkanov [ Wed Jan 30, 2013 6:00 am ]
Post subject:  Re: C# performance

1. at many tasks C++ and C# have comparable performance. For example, optimization, kd-trees, interpolation... The most important problem where C# is really slow is linear algebra. Highly optimized SSE-capable C++ code can be 10x times faster.

2. Probably, you won't get good performance with such C#/C++ interface, unless you solve high-dimensional problem with hundreds or thousands of variables. In lightweight cases you will lose a lot of time converting/passing data structures between C# and C++.

Author:  Stabilitronas [ Wed Jan 30, 2013 7:34 am ]
Post subject:  Re: C# performance

Ok, I'm not very experienced in numerical calculation, but I guess fitting my function with 2000 data points and 5 parameters does not qualify for heavyweight case to make the C++/C# wrapper viable? What about fitting a two-dimensional Gaussian with 1 million datapoints?

Author:  Sergey.Bochkanov [ Wed Jan 30, 2013 7:37 am ]
Post subject:  Re: C# performance

First case is definitely for pure C#... As for the second case, I am not sure :) but I think that you can have good enough performance with C#, difference will not be striking. Maybe, 2x, at the best (or worst) case.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/