I have a question about the performance impact of including the entire
armory libraries in a game build for Krom. Here is my setup in more detail.
I have the following extra parameters added to the
hxml ( by setting the in the
khafile.js ) :
--macro include('kha', ['kha.graphics4.hxsl.*', 'kha.netsync.NodeProcessClient', 'kha.netsync.Example', 'kha.HaxelibRunner', 'kha.internal.*']) --macro include('iron', ['iron.data.GreasePencilData']) --macro include('armory', ['armory.system.*']) --macro include('haxe', ['haxe.macro.*']) --macro armory.system.Modding.exposePack('arm') --macro armory.system.Modding.exposePack('kha') --macro armory.system.Modding.exposePack('iron') --macro armory.system.Modding.exposePack('armory')
I'm using this to allow for modding. The code for any mods is loaded in at runtime using
eval and I am using the
armory.system.Modding.exposePack('arm') macro to add the
@:expose metadata to the packages so that the mods can access the exposed APIs.
This obviously defeats stuff like dead code elimination, but I can't know ahead of time what portions of the API mods are going to use, so I have to include the entire API in the game output.
My problem is that by simply adding the
include macros, my Armory game's frame rate is a lot lower. I don't have a very good computer, but for my test scene that I simply fly around in:
- Without the includes the frame time averages around 35ms.
- With the includes the frame time averages around 55ms.
I thought that maybe the file size was the problem, but the file size difference is only roughly 300kb. Also If I uglify the bigger file the difference is only 100kb, but the performance difference still stands.
Anyway, my question is whether or not there is any way to help this or if that is just how it is. I was surprised that the performance was so different when I wasn't using any of the extra APIs or doing any extra work, my program is just bigger because there are more classes and functions. Or could it just be that my computer is slow ( slow disk speed and low graphics ) and that it just exaggerates the effect.