As the title suggests, I'm wondering what the performance implications would be about doing this.
Some context first, to explain why I would even want to do this. I have a pretty simple game engine project that I've recently brought back out of moth balls. It's not much yet. All I've built with it is a recreation of space invaders, which I did mainly so I could create the basic, reusable components (TransformComponent, SpriteComponent, RenderingSystem, etc), and then merge them into the core engine dll.
The whole thing is in C++ at the moment, and to be honest, I'm pretty rusty since I haven't done much active development in C++ for quite a while. C# on the other hand is my day job, and something I use in other hobby projects, so I'm quite comfortable in it.
As a result, I'm thinking about writing a C# layer on top of the core C++ library, which would consist of the Entity Component System, and anything else that would be required to facilitate that. Part of the appeal is that I can't really be bothered to implement an entire scripting system, nor do I want to deal with the nonsense of C++ when I'm just doing basic gameplay programming, and I think C# is a nice middle ground.
So, here's the question: how ill advised would that be from a performance perspective? I don't want to spend all this time rewriting the engine just to profile it at the end and realize I've been marching towards a dead end.
An entity component system typically consists of many small objects, so would C# just have too much of an overhead to deal with it?
And what about P/Invoke? Everything I've read about it suggests that it may be a real performance bottle neck, especially if I make managed to unmanaged calls frequently.
I know that Unity uses C#, but lets face it, they have far more time and resources to overcome any problems that would arise.
Any input on this approach would be greatly appreciated.