perf: Only sort wrappers when adding them#61438
Conversation
|
Does it worth sorting them only when needed? Add some kind of dirty flag: when a wrapper is added, dirty is switched to |
2f30a6f to
fc4bfa3
Compare
done. Not sure that improves that much the perf as the list of wrappers is very small, but it is also a very simple change that doesn't make the code much more complex |
Instead of doing that each time a new mount point is created (e.g. for the 7000 shares we have in production). Signed-off-by: Carl Schwan <carlschwan@kde.org>
fc4bfa3 to
a6f432f
Compare
| @@ -44,6 +47,7 @@ public function addStorageWrapper(string $wrapperName, callable $callback, int $ | |||
| */ | |||
| public function removeStorageWrapper(string $wrapperName): void { | |||
| unset($this->storageWrappers[$wrapperName]); | |||
| $this->dirty = true; | |||
There was a problem hiding this comment.
unset should not change the order 🤔
|
🤦 I implemented again the same thing forgetting I had even reviewed this one. I did it a bit differently, keeping the references of sorted wrappers in memory, so we wouldn't need to keep doing array operations at every wrap. Since |
Instead of doing that each time a new mount point is created (e.g. for the 7000 shares we have in production).
Summary
TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)