C# to C++ multithreading, any issues to expect? -
after lot of testing have dozen algorithms don't give me satisfactory speed in c# , work fine in c++ (implemented same way, pretty copy pasted c# c++, heavily array based on large data sets).
now know how call c++ code c# , don't want switch whole application over, i'm thinking of doing that. micro kernels must run heavily in parallel , since parallelism in .net nice, thinking of handling on side, , having each thread c# call whatever relevant.
it sounds me shouldn't have issues thread safety way (i'm not calling c++ lib functionality, methods taking arrays input , returning arrays output, data not shared accross threads on either c++ or c# side). since i've never had question : stupid? missing huge elephant in room or should fine? have worry wether use mt runtime on c++ side or not considering don't call in of system calls?
each microkernel slow enough (100+ms) .net boundary cross not big issue , substantially faster in c++ i'd rather avoid porting code , testing realise missed obvious.
yes, safe way marshalling accross c++/c# divide has overhead.
some thoughts:
consider using c++ cli
if algorithm data parallel consider using gpu either via managed library or using cuda via c++ (there managed wrappers)
i have not used ryujit (the new jit compiler) in .net yet, capable of using simd instructions may prove useful without having go c++.
Comments
Post a Comment