diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-07-11 21:52:01 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-15 13:09:37 +0200 |
commit | 2e5b8032a27f678b1f514c7402fe2a808e7fcdcc (patch) | |
tree | ae1817de684c61c7a2b9e3bf2a10d01497b63970 /src/corelib/io/qprocess_p.h | |
parent | a7383b4b6dde54569e6fdfa0888e474a37416a51 (diff) |
Optimize QInotifyFileSystemWatcherEngine::getPathFromID()
The code basically wants to get the last element of equal_range(id).
The problem is that backwards iteration on QHash is very expensive,
because it's implemented as forward search with wrap-around at bucket
end.
So it was implementing its own equal_range with look-ahead. The
problem is that it compared each key in the equal_range twice: once in
the if, and once more in the following while iteration.
I expect to see this kind of algorithm more as we move away from the
fake bidirectionalism of QHash, so I decided to implement it in a
generic way. We can copy it somewhere else when we find more users.
Change-Id: I7951652107ab897f6a456035f02e0339835e078d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/io/qprocess_p.h')
0 files changed, 0 insertions, 0 deletions