Skip to content

Cache library-detection results #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matthijskooijman opened this issue Mar 14, 2016 · 1 comment
Closed

Cache library-detection results #127

matthijskooijman opened this issue Mar 14, 2016 · 1 comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement
Milestone

Comments

@matthijskooijman
Copy link
Collaborator

For bigger sketches (or rather, when using bigger libraries with lots of source files, like U8glib), the library detection step can take fairly long (I've seen 10-20 seconds IIRC). When you have made only little changes, it's a bit of a pity having to wait for this on a recompile. In addition, it leaves the impression that hings are actually being recompiled even when they're note (see arduino/Arduino#4672, and I've wondered the same thing myself too).

It would be good if we could cache the results of the library detection scheme during the build, and simply use the previously detected values on subsequent runs. This should probably, for each source file, store the names of the included files as taken from the preprocessor output, and then re-resolve these names to actual libraries on every compilation (since that part is probably fast enough). At first glance, you might think this allows changing the list of libraries (and thus the resolution step) in between compiles without having to re-run the dependency selection, but since each subsequent step of the dependency resolution actually includes previously selected libraries, this isn't actually the case. Hence, it might be better to actually store the libraries selected by each source file, instead of the .h filename the library was selected for. If the list of libraries ever changes, compilation should be redone (I guess keeping a timestamp of the last library list reload in the build options might be sufficient for that?).

Storing these values could be in a separate file, or perhaps we can simply use the values stored by gcc in the .d files already (these are full .h paths, so I'm not entirely sure if this applies). Given the above, a separate file (per source file) is probably better, containing paths to the selected libraries.

To invalidate these cached values, we can use the same mechanism used to invalidate the source files: If the source file itself, or any of its dependencies, is newer than the cache file, it should be regenerated.

@cmaglie
Copy link
Member

cmaglie commented Aug 26, 2016

Fixed by #175

@cmaglie cmaglie closed this as completed Aug 26, 2016
@per1234 per1234 added conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement labels Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

3 participants