Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upcleanup: reduce the number of `#include "env.h"` and `#include "env-inl.h"` in the code base #27531
Comments
joyeecheung
added
C++
good first issue
labels
May 2, 2019
This comment has been minimized.
This comment has been minimized.
|
I think this is a good first issue if you know how forward declaration and C++ headers work. If nobody picks this up (say in a week) I'll do it anyway because...I touch |
This comment has been minimized.
This comment has been minimized.
BTW I believe that as of C++11 this assumption is not as relevant as it used to be. |
This comment has been minimized.
This comment has been minimized.
Jinshuo1994
commented
May 4, 2019
|
I think the instructions from @joyeecheung are very clear. Can I take up this issue? Thanks! |
joyeecheung commentedMay 2, 2019
•
edited
Because of how
Environmentis used in the code base (e.g. to grab Node.js things from callbacks, to have fast access to persistent properties),Environmentis used in almost every C++ file, which results in a lot of#include "env.h"and#include "env-inl.h"in the code base. However many files (mostly headers) only need a forward declaration ofclass Environmentinstead of requiringenv.horenv-inl.hbecause they just need to know theEnvironmenttype to haveEnvironment*in the declarations. When there is code in a header that actually uses something fromEnvironment(so a forward declaration is not enough), the code may be moved out of the header if it is not in a hot path (i.e. it does not need to be inlined).Reducing the number of these includes should reduce the amount of files being compiled whenever
env.h/env-inl.his touched.