Sandbox Virtual Machine for an Application (C++ vs. C#)
I'd like to write a sandbox virtual machine for executing a compiled program. How do you think: whi开发者_开发技巧ch of these two languages would be better to use if we consider performance? Or maybe you suggest another one?
The performance of your VM will be much more affected by how you implement it rather in what language. If you implement it the same way in c# and c++ the performance will be comparable.
The thing that speaks in favor of c++ is that you can execute parts of the native code from your sandboxed application directly. It is possible to do the same in c#, but that requires some translation and emitting corresponding byte code with Reflection.Emit
.
You can't do this in C#, I guess, because there are several things that would require assembler, not talking about unmanaged code itself. So C++ with some assembler would be the only option.
精彩评论