From 1a5b12aa5da2c718848d3cc5d9bce7bfcdeacf54 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 18 Apr 2019 15:13:19 +0200 Subject: 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 --- package/source/zipapi/ZipFile.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'package') diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 24bcab959960..f37f38c03e62 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -1065,8 +1065,7 @@ void ZipFile::recover() aEntry.nSize = 0; } - if ( aEntries.find( aEntry.sPath ) == aEntries.end() ) - aEntries[aEntry.sPath] = aEntry; + aEntries.emplace( aEntry.sPath, aEntry ); } } } -- cgit