Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index



On Sat, 2010-11-27 at 21:02 +0000, Caolán McNamara wrote:
As Takeshi pointed out in another mail, the postfix form returns a copy
of the iterator as it was before the increment, while the prefix form
returns a reference to the current value after its increment. So postfix
requires an extra copy which makes it inherently slower.

        Oh nice; not something I had noticed. Can we do a big global hunt & fix
for all these instances ?

I'm not so sure that compilers can optimize STL postfix operators with
the ease they do for basic types. Their implementation differs quite a
bit from one impl to another.

        Quite; optimising LO's C++ is quite excitingly limited in many ways
(often by the low-level C API impls eg.).

Anyway, I reckon its worth tackling the cppcheck warnings about the
postfix operator being used where a prefix would suffice.

        Yes - would be wonderful to have a "fix this entire class of problem"
approach to the code-base; to win the performance & size improvement
everywhere - and to make the patch easy to review too I guess ;-)

        Interesting,

                Michael.

-- 
 michael.meeks@novell.com  <><, Pseudo Engineer, itinerant idiot



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.