New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NativeAOT compilation support #19520
Comments
I believe mono allows you to compile a mono application into a shared library/compiled code. Dotnet may also support this. Is this what you mean? Why would it require rewriting parts of the code? This solution could be marginally faster when loading. But once dotnet or mono have just in time compiled IL to native instructions I don't expect a huge performance improvement. This because the compiled and JIT code will mostly look the same. No using reflection and not using generics will require a full rewrite of the game engine. You might as well re implement it in c++ or rust then. Will be a big project. |
I agree. I may speculate that startup time important for standalone servers, but again that has to be measured. I prefer that members of this project set measurement goals and what to measure. That way I would not measure something not important.
I probably go too deep in technicalities when attempt to explain scope. Ignore what I wrote later, if its too distracting. My modus operandi would be have least amount changes to this project. Now to technicalities.
Some things like Again, I expect changes to be trivial in nature, and any re-engineering mean experiment is busted. |
Hi. Unfortunately I don't think removing all reflection and assembly loading is compatible with the way OpenRA is meant to be used for mods, so I doubt we can take such changes directly into the main branch. I don't see anything in the way of a forked demo project though. As measure it might be enough to simply measure the start-up time used to get into the shellmap (menu background). P.S. If you want to have a chat you can join our Discord server (https://discord.openra.net) where most of the core devs are available. |
This is initial concept. https://github.com/kant2002/OpenRA/tree/nativeaot I add 2 sample applications
Both applications do not allow changing mods during runtime. That's expected and nothing I can do about that. Publishing stepsFor publishing
then run using
For publishing
then run using
I did not test performance, just make it compile. Subjectively startup time for server become noticeable faster, but I need instrument things to measure properly. Maybe that's related to my computer. Application seems to be not that much affected. Sizes of application become slightly bigger then I expected- 96Mb both. That's indirectly indicate on tight coupling of code, but I will try take a look to understand what consuming space. |
Motivation
My motivation is to set experiment for evaluation limits of NativeAOT compilation for .NET. I have hopes and expectations that performance overall should improve a bit. I can only speculate about effects. Even if experiment fails to reach meaningful improvements, codebase should be in a state which would be more friendly for R2R and better suited for ILTrimming in case if somebody needed.
Proposed solution
I would like to test interest of core team in this experiment. Eventually this is for them to decide if this helpful or not. Would be extremely good to have one core team member to sponsor this work (i.e. look over my shoulders and help understanding codebase, also allocate some cycles for that).
If received positively, I can start contributing. I hope minor changes lands main repo, and if some substantial changes arise, they can live on branch. That's up to further discussion.
Side effects
Some changes I expect to be cosmetic, like
Enum.GetValues(typeof(T))
=>Enum.GetValues<T>()
, other may be slightly more involved. I expect if localization done usingResourceManager
then maybe some issues can appear when targeting smaller size. My goal is to produce executable of smaller size, so I expect eventually disable reflection, and as such modding API would not work. That require provide alternative way how load mods into executable which is friendly for static compilation. Again, if this appear too radical of a change it would be better left that on a branch and discuss until agreement would be reached (or not).Alternatives
Technically I do not consider alternatives to NativeAOT, since that's the point. Other options I'm flexible, since I want that experiment to succeed.
The text was updated successfully, but these errors were encountered: