S
Shawn B.
Greetings,
Lets say I have this class written in standard C++. I want to expose it to
C# programs. So lets say I create a ref class to "wrap" around the standard
C++ class. What are the performance implications of doing so?
For the sake of clarity, the class is currently written in C#. It is a CPU
emulator. C# performs well, but after rewriting it in C++/CLI it performs
even better. But I'd like to rewrite it in standard C++ and provide it to
..NET only through a wrapper. I won't be calling too many functions on the
object... just something like CPU cpu = gcnew ^CPU(); then cpu->Execute();
for the most part.
However, "Devices" plug into the CPU. So I can plug a display device to act
as a monitor and a keyboard device to act as a keyboard and a storage device
to act as something storage related. Since this is an old 8-bit and 16-bit
CPU (65c02 and 65816 to start with), these devices just specify what memory
locations they are monitoring and whether they are monitoring read/write
events or both.
The kicker is that, while the main application loop only calls
cpu->Execute() once, each device gets notified via delegates/function
callbacks. So, everything the CPU (or the memory manager mostly) needs to
notify something, there will be an unmanaged->managed interaction.
Can someone point out to me whether the performance implications are
(potentially) great enough that I'm better off continuing to keep in managed
code or what. Obvisously, I can try write it out and run tests to figure
this out for myself but I'd rather ask someone first, to get an idea what
I'm up against and whether its worthy my already stressed availably to do
so.
Thanks,
Shawn
Lets say I have this class written in standard C++. I want to expose it to
C# programs. So lets say I create a ref class to "wrap" around the standard
C++ class. What are the performance implications of doing so?
For the sake of clarity, the class is currently written in C#. It is a CPU
emulator. C# performs well, but after rewriting it in C++/CLI it performs
even better. But I'd like to rewrite it in standard C++ and provide it to
..NET only through a wrapper. I won't be calling too many functions on the
object... just something like CPU cpu = gcnew ^CPU(); then cpu->Execute();
for the most part.
However, "Devices" plug into the CPU. So I can plug a display device to act
as a monitor and a keyboard device to act as a keyboard and a storage device
to act as something storage related. Since this is an old 8-bit and 16-bit
CPU (65c02 and 65816 to start with), these devices just specify what memory
locations they are monitoring and whether they are monitoring read/write
events or both.
The kicker is that, while the main application loop only calls
cpu->Execute() once, each device gets notified via delegates/function
callbacks. So, everything the CPU (or the memory manager mostly) needs to
notify something, there will be an unmanaged->managed interaction.
Can someone point out to me whether the performance implications are
(potentially) great enough that I'm better off continuing to keep in managed
code or what. Obvisously, I can try write it out and run tests to figure
this out for myself but I'd rather ask someone first, to get an idea what
I'm up against and whether its worthy my already stressed availably to do
so.
Thanks,
Shawn