KProtocolInfoFactory::findProtocol clears its cache when requested an unknown protocol in the hope of finding it due to an outdated cache. However, when the cache had just been created, there's no point in clearing and recreating it right away
- Group Reviewers
- R241:a9625a3be6b1: [KProtocolInfoFactory] Don't clear cache if it had just been built
Mitigates the effects of D9094 somewhat (takes 4.5ms instead of 9ms on startup for me now)
Good idea, but every time one of those state tracking bools get copied my mind screams "BAD PATTERN". It's not the fault of your patch but I don't like how this cache handling is written - it'd be cleaner if fillCache had a return value for "I actually did work" and if the meaning of m_allProtocolsLoaded got inverted to being a dirty bit, so fillCache() itself can take care of the cache eviction code (qDeleteAll etc.) if dirty is set. Doing this instead creates a "now every time you want to change things you have to read site first and copy some boiler plate" situation.