diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-18 15:13:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-19 13:19:31 +0200 |
commit | 1a5b12aa5da2c718848d3cc5d9bce7bfcdeacf54 (patch) | |
tree | 25044edc2afb99073ba6bef8d181dadbb6a53467 /registry | |
parent | eaaaad0e21edb27edaa865eee03696f007cd8010 (diff) |
optimise find/insert pattern
if we're doing a find/insert on a set or a map, it is better to just do
a conditional insert/emplace operation than triggering two lookups.
Change-Id: I80da5097f5a89fe30fa348ce5b6e747c34287a8d
Reviewed-on: https://gerrit.libreoffice.org/70937
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'registry')
-rw-r--r-- | registry/source/regimpl.cxx | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index ea074732df12..63c937a1109a 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -1109,11 +1109,8 @@ static sal_uInt32 checkTypeReaders(RegistryTypeReader const & reader1, } for (sal_uInt32 i=0 ; i < reader2.getFieldCount(); i++) { - if (nameSet.find(reader2.getFieldName(i)) == nameSet.end()) - { - nameSet.insert(reader2.getFieldName(i)); + if (nameSet.insert(reader2.getFieldName(i)).second) count++; - } } return count; } |