January 6th, 2011, 07:22 AM
C++/CLI vs CSharp viz numerical code and cloud
(forgive me if my knowledge managed code and cloud computing are lacking, my background is in building mathematical code in plain native C++ and I am new to managed code).
I am embarking on a project which is finance-related. The core part of the project is mathematical/numerical in nature and is highly computationally intensive. Attached to this will be a number of user interfaces including an excel interface and a console application interface (possibly others). Usually, the user will be using an excel interface on Windows. However, I can see that the ability to deploy the analytics to a cloud could be of significant value to potential customers. My main concern is building compatible code. I have a number of concerns.
(1) To deploy an application to a cloud all dynamically allocated memory must be allocated on a garbage-collected managed heap. (is this true?)
(2) To fulfill (1), I need to use C++/CLI (or maybe C# or java)
(3) If I used C++/CLI, then 3rd party libraries (eg boost) will not, in general, be limited to using the managed heap and render the application unusable on a cloud. Is there some kind of viable work around for using 3rd party libraries?
(4) Even if I could avoid using 3rd party libraries or find a work-around for (3), is there some non-pathalogical way of structuring the code in C++ so that it compiles in linux under gcc (and intel) 'natively' and with all objects being managed under windows? (I can conceive of some hideous solution using #define's for all the __gc, and ^ syntax, but it would be really messy). I certainly like to compile C++ on linux too, for the warnings and valgrind if nothing else.
(5) What is the performance hit of using C# (or java). From what I have read on the internet, well-written numerics in C# and java are comparable in speed to C++. However, these have tended to be small toy problems and my concern is that maybe C# and java can be more memory hungry which may slow down the numerics for serious mathematical problems.
I have spent a couple of months on the project already and can see how to do virtually everything in plain native C++, however, compatability with cloud computing is a real concern to me and would be more than willing to rewrite in C sharp if I new that the performance hit was not too much (say, 30% or 40% slower) and that it would solve all the issues related to compatability with the cloud.
All advice and correction of my misunderstandings are welcome. Can anyone see a workaround for doing everything in C++ (/CLI)? (I don't want to write my own date or smart pointer classes, so ability to use third party libraries like boost is more a less a necessity)
Thanks in advance,
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.