forum.alglib.net

ALGLIB forum
It is currently Thu Dec 08, 2022 7:17 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: C# performance
PostPosted: Tue Jan 29, 2013 9:08 pm 
Offline

Joined: Tue Jan 29, 2013 8:54 pm
Posts: 4
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?


Top
 Profile  
 
 Post subject: Re: C# performance
PostPosted: Wed Jan 30, 2013 6:00 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 880
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++.


Top
 Profile  
 
 Post subject: Re: C# performance
PostPosted: Wed Jan 30, 2013 7:34 am 
Offline

Joined: Tue Jan 29, 2013 8:54 pm
Posts: 4
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?


Top
 Profile  
 
 Post subject: Re: C# performance
PostPosted: Wed Jan 30, 2013 7:37 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 880
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group