openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

more .h includes simplification

Open dimitre opened this issue 1 year ago • 1 comments

This PR removes some includes from ofConstants.h and include by demand where needed. includes are:

#include <stdint.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <iostream>
#include <vector>
#include <memory>
#include <functional>

We can add them to ofMain.h to assure they are still added on projects

Linux action runner is failing because of libgconf-2-4

dimitre avatar Nov 12 '24 21:11 dimitre

good to go. should we re-add includes in ofMain.h to keep all of them available ?

dimitre avatar Nov 13 '24 01:11 dimitre

I've brought this PR to be compatible with master if it is a good idea lets merge or discuss it if not merged I'll be closing by November 24 (PR birthday)

cc @ofTheo @NickHardeman @artificiel

dimitre avatar Nov 17 '25 14:11 dimitre

Thanks @dimitre - have you benchmarked the compile time difference with this change and without? I'm all for speeding up compile times and it would be good to know if this PR has a significant impact.

Generally ofConstants.h is where these things are meant to live, so moving to ofMain.h would only make sense if we can see a big speed up.

Thanks! Theo

ofTheo avatar Nov 17 '25 17:11 ofTheo

@ofTheo I didnt think it would make much differente but in fact if we compare the runners in this one against another normal PR like this we see improvement in compile times in all runners. sometimes less than 50% original time. take a look:

https://github.com/openframeworks/openFrameworks/pull/8187/checks https://github.com/openframeworks/openFrameworks/actions/runs/19430409178/job/55587700525

This PR removes lots of unneeded system includes (sometimes they are huge) so compiler has much less lines to process

dimitre avatar Nov 17 '25 23:11 dimitre

@dimitre wow, yes, I see the difference too! Weird that VS seems unaffected but msys2 has the same 50% speed up.

Seems worth it for the speed up alone and people typically include ofMain.h so seems fairly safe

ofTheo avatar Nov 18 '25 16:11 ofTheo