I am creating a prototype for a quantitative library that does some signal analysis using image processing methods. I completely created the original prototype in C #, but the performance is not as good as expected. Most of the calculations are performed using heavy matrix calculations, and they take up most of the time.
I am wondering if it's worth writing a C ++ / CLI interface for unmanaged C ++ code. Has anyone ever gone through this? Other suggestions for optimizing C # performance are welcome.
There was a time when it would definitely be better to write in C / C ++, but the C # optimizer and JIT are so good now that there is probably no difference for pure math.
The difference arises when you have to deal with memory and possibly arrays. However, I was still working with C # (or F #) and then would optimize the hotspots. JIT is really good at optimizing small, short-lived objects.
With arrays, you need to worry about C # fulfilling restrictions - checking every access. Read this:
http://blogs.msdn.com/b/clrcodegeneration/archive/2009/08/13/array-bounds-check-elimination-in-the-clr.aspx
Test it yourself - I believe C # is comparable - sometimes faster.
, , .
- , , ++ # - ++ , CLR JITER , . ++ # .
. . , .
, ++/CLI , . , , , - .
, . ++ , LAPACK.
# LAPACK ( # BLAS ), , , , .
#, , , , , PInvokes, ++/CLI. .
.NET. Red Gate - . , .
: http://shootout.alioth.debian.org/
.
++, ++-, #. , . ++, # , .NET ++. , # , - ++. # ++, ++, - #.
x - ++, y - #, x , y. y , x .
#. gobbsmacked, , #. # ++, , Sin, Cos,... .
, ++, imlpementing ++ abd umagine P/Invoke .
, .
#, , .
:
++ , #. , , , , , . ++. # ++, ++, , . . ++. , , # Java, - .
, , , #, , .
, ( , , ). , , .
- ++ , , Fortran ( ), ( ) , .
? # ?
Source: https://habr.com/ru/post/1775222/More articles:Finding the frame rate on a custom Java component correctly - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1775218/is-there-a-possibility-to-assign-cssclass-to-checkbox-within-checkboxlist&usg=ALkJrhiEs578stzLqW4fhCfUn503_Q5BDgPrevent order confirmations sent via PHPMailer as a result of spam - phpИспользование Содержит в ObjectQuery - c#SQL Server Question - XML query - sqlPretty javascript multiselect widget suitable for Spring Roo / Web MVC project? - javascriptFinding a way to store binary versions compiled from git repo - gitWPF: use a specific icon image in an image element - wpfIn SugarCRM, transferring account ownership to another user does not update contact property - sugarcrmTesting a method using nunit that requires configuration from ConfigurationManager - c #All Articles