开发者

Sandbox Virtual Machine for an Application (C++ vs. C#)

开发者 https://www.devze.com 2023-01-22 21:33 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号