As some of you know, we (geekrelief and I) have been working hard on NimForUE (https://github.com/jmgomez/NimForUE) for the last couple of months. We almost reached a point where you can develop a full game in Nim and taking advantage of pretty much all of the essential engine features. Including stuff like in game hot reload, in editor hot reload (you can create editor stuff without restarting it), and much more (see the readme of the repo if you are curious of what you can do). There is no other plugin to date that covers all of that.
AngelScript is the closest but they needed to modify the engine to do so. Not to mention the language is just a toy.
We finished (today) an automatic binding of most of the Engine API, 50k+ lines of code just in that module, there are tons of modules. The C++ compilation is instant because we use PCH and C++ has incremental compilation. However, the Nim compilation is really slow (no macros, just basic nim). Every time you do a minor change you have to wait 15 seconds+ on a Threadripper with 24 cores. Equivalent change with the LiveCoding feature in C++ using stock UE is about 2-4 seconds. This defeat the whole purpose of the plugin since fast iteration is key to develop a game.
The question that I have is, is there any special branch where we can try Incremental Compilation? I assume it isn't devel because it doenst compile for a hello world. Any other suggestion is welcome
Thanks,
Juan
Honestly I'm in the same boat. I'm using Nim at work every day and the 30+ second build times for my project are a real drag (especially when working on UI and cutscenes, it's always "move sprite by 1 pixel, recompile... oh looks like I need to move it down by 1 pixel too, recompile... maybe that animation should be slightly faster, recompile...")
I'm looking forward to all other improvements that V2 may bring, but incremental compilation is the single biggest thing that would make my life better right now.
Nim caches per file, if you change one line in a file it recompiles all (which is why include and big single file are not optimal).
Would it be possible to split your autogenerated 50k lines file into multiple files?
P.S: don't know why this is written in bold.
> You autogenerate 50k lines of code, you do not edit them, and still have to recompile them each time ?
Yes, just like when you try to import a big nim lib i.e. import compiler / [ast, nimeval, llstream, types]
> Do your changes forces to autogenerate 50k LoCs each time ?
No
In that case you might get away with first compiling your 50k LOC into a shared or dynamic library. And the part that changes links to that library.
We thought about it too, there are limitations around them so I decided to do a test where we persist it back to C++, with a similar code of what we are doing with the engine and for 1.7M LoC it goes from ~33seconds to ~5 seconds. So that maybe good enough. The idea is to then precompile that C++ into a PCH so it doesnt increase C++ compilation times.
I also took a look at IC and was able to add a feature where it caches the modules you specify to the compiler (so you can get around the issues and cache only what you really need). I need to look more closer into it because there is an initial overhead of using IC that makes it slower than not using it all for big files.
Ideally at some point we will be able to do a combination of both approaches
After a lot of troubles, @geekrelief and I were able to test the approach above with the bindings and it worked. It adds around a second to the prev base compilation. The numbers are consistent with the tests that we did were it went from ~33seconds to ~5 seconds.
The best thing is that with a bit of work the approach can be generalized