Probably a silly Q (C++ .dlls in .NET)

wyrd

Senior Contributor
Joined
Aug 23, 2002
Messages
1,405
Location
California
I have a .. well, silly question. :)

If you program something in C/C++ and compile that into a .dll for use in your .NET program, will the code run faster then say programming that same thing in .NET and compiling that into .dll?

Basically it breaks down to C/C++ .dlls vs. .NET .dlls. Common sense to me would say that the code in the C/C++ .dlls would run faster (not by much, though) and thus make your .NET app run faster. But, I don't know how .NET compiles .dll files in comparison to C/C++ so..

Yeah, I know silly question. Come to think of it, instead of asking I probably should just run some benchmark tests of my own. :eek: But regardless of that I'm searching for possibly more of a technical answer (as to why they run the same speed or one is faster and how .NET compiles .dlls)
 
It depends whether you're writing managed C++ code or unmanaged. With managed you'll get the advantages of the JIT compiler which can give results either slower or faster than natively compiled code, depending on application. If you're writing unmanaged code the only slowdowns could be marshalling to/from it if you're calling it repeatedly.
 
Back
Top