Stephane-D / SGDK

SGDK - A free and open development kit for the Sega Mega Drive
https://www.patreon.com/SGDK
MIT License
1.74k stars 187 forks source link

Optimization idea for rescomp #299

Closed thomasgoldstein closed 10 months ago

thomasgoldstein commented 10 months ago

Hello.

I wanted to suggest the following optimization for rescomp, which would make our life much easier:

Add the ability (as default behavior or as an optional flag) to skip the generation of the output files (.d and .o) if their last modified date is more recent than the last modified date of the source png image.

That would make our game's compilation process much faster and would allow us to use the slower but more optimal compression levels of rescomp.

What do you think? Thank you.

Edit: There's a possibility my suggestion does not make much sense, so feel free to challenge it. I say that because when cleaning the solution using the "Genesis Code: clean" command, then the .d and .o are deleted. Which means maybe my idea would only make sense when using rescomp directly, and I don't know if many people do that.

In my case, I believe what I could do instead is selectively delete the .d and .o files from scripts whenever I want to rebuild certain sprite sheets only. That would cover all of my needs. Or maybe dynamically update the .res files instead.

thomasgoldstein commented 10 months ago

I'm closing this because I think it's not a useful suggestion after all, and I'm going to consider alternatives. Sorry!

My current idea: after having generated png images, my script is going to update the concerned .res files just to update their dates and lead rescomp to regenerate the .d and .o files only when needed.

Stephane-D commented 10 months ago

Hi @thomasgoldstein

Normally if make was doing a correct job, it would only rebuild required file and so using rescomp to rebuild resources only if resource files as .png were modified, the .d file are generated for that exact reason (to properly handling file dependency). The problem is that make is not handling that correctly and usually rebuild the whole even when they didn't changed. I should investigate that problem, maybe the issue is in the makefile itself. Still you solution is probably better suited for your needs ;)