Skip to content
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

Cache config/setting file misses too #417

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

kastiglione
Copy link
Collaborator

@kastiglione kastiglione commented Oct 5, 2018

SettingsBuilder.swift has two caches for BuildSettings, for xcconfigs and settings presets. The caches ensure existing files aren't redundantly reloaded, but for non-existent files they don't cache the fact that no settings file could be found, which means redundant searches for any optional settings file that does not happen to exist. Each failed search is repeated work. For the project I'm working on, this is most expensive in SettingsPresetFile.getBuildSettings().

This change makes these caches also cache which config files do not exist. For just getBuildSettings(), this change reduces the memory use, down to 1.7mb, from a little over 10mb. The sample project has ~40 targets but real world targets for us will be bigger.

This change adds an Optional equivalent enum named Cached. This is to avoid having a dictionary value of an Optional type, otherwise the subscript operator would return an Optional<Optional<T>>, which can be awkward to work with.

@yonaskolb
Copy link
Owner

Great stuff, thanks @kastiglione!

@yonaskolb yonaskolb merged commit f7966bd into master Oct 8, 2018
@yonaskolb yonaskolb deleted the cache-build-settings-misses branch October 8, 2018 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants