[Interest] Qmap insert versus operator[]
Thiago Macieira
thiago.macieira at intel.com
Tue Nov 5 18:20:41 CET 2013
On terça-feira, 5 de novembro de 2013 13:45:07, Olivier BARTHELEMY wrote:
> Hi,
>
> Given code that would look like :
>
> QMap<SomeType> theMap;
> ....
> {
> theMap[someIndex] = someValue;
> }
>
> Is it safe to assume that replacing the operator with the insert method
> will improve the performance for new elements (copy constructor used
> directly instead of default constructor + assignment operator ), while not
> being slower for the modification of an element that already exists?
Konstantin is right -- if you care about performance at this level, check with
a profiler.
However, given what I know from QMap's source code, you'll probably find out
that you are right.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131105/2d265592/attachment.sig>
More information about the Interest
mailing list