Open bnoordhuis opened 2 years ago
I ran rtags
and hacked together something to put the results into SQLite.
The line count is approximate (it's literally based on the number of visual lines
the function takes up), but looks to already identify some big ones:
Also can look at number of callers. There are some mistakes here, f.ex. some are marked as having zero callers when they clearly have some.
Hopefully this provides a burndown list for people looking to work on this.
Here is a (gzipped) copy of the database for those looking for a finer-grained analysis: inl.db.gz
@bnoordhuis I have refactored stream_base-inl.h
and managed to get the binary size down by 4 bytes (in 9 compilations out of 10). Would you accept a PR?
@lilsweetcaligula I'm going to guess most calls come from src/stream_base.cc if moving code around only slims down the binary by 4 bytes. But sure, pull request welcome.
Inspired by me setting a breakpoint on a function and gdb telling me there are 12 locations...
The idea behind the
*-inl.h
files is to provide inline definitions of short functions. Large gobs of code don't belong in them because they negatively impact:Rules of thumb:
.cc
file.cc
fileCHECK(..)
expand to multiple lines of code and should be counted as suchGood (short, many callers): https://github.com/nodejs/node/blob/7d13f5e34f7a9e98b925d7fdf77ebfadb7ed17d8/src/env-inl.h#L56-L58
Not good (big, only two infrequent callers): https://github.com/nodejs/node/blob/7d13f5e34f7a9e98b925d7fdf77ebfadb7ed17d8/src/env-inl.h#L349-L365
Questionable (single infrequent caller): https://github.com/nodejs/node/blob/7d13f5e34f7a9e98b925d7fdf77ebfadb7ed17d8/src/env-inl.h#L510-L518
The most commonly used
*-inl.h
files are: