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


On Tue, Jan 10, 2006 at 10:25 PM, Kayo Hamid
<kayo.hamid@gekkolinux.com.br> wrote:
On 08/01/2011 17:00, Norbert Thiebaud wrote:

I' confused:
-    sal_Int32 nCount = xAcc->getAccessibleChildCount();
-
-    for( sal_Int32 i=0; i<  nCount; i++ )
+    const sal_Int32 nCount = xAcc->getAccessibleChildCount();
+    sal_Int32 i = 0;
+
+    while(i<  nCount)
     {
-        if( xAcc->getAccessibleChild( i ) == xThis )
-            return i;
+           if( xAcc->getAccessibleChild( i ) == xThis )
+                   return i;
+           i++;
     }
+

Unless I'm really dense: this simply change a for() loop into a
while() loop doing exactly the same thing
Why is it supposed to improve performance ?

as for the rest:
Did you really measure that turning a passed-by-value scalar (which
caller's value cannot be modified by the callee, by definition) into a
const passed by value
 scalar, has _actually_ any performance impact ?

Norbert

Hello Norbert, first of all i'm new at coding, I really do not know if we
have any improve, but after looking a lot for c++ performance tips (and I
continue looking and reading tips for that) I have in my mind some things
like:

for/while -> it's better to use while, it's not a huge improve, but you can
find tips that say 'use while, it's better'. I just do it.

I'm afraid that is a bad advice.
I doubt very much that there is any such performance impact (and if
so, open a bug with the compiler). and even if there was a one or 2
instructions differences, this would have to be in a very-very tight
loop to be significant (i.e measurable).


const -> my goal is to change the local variable to const is to put it in
read-only, wich is better,
Why is it better ?


It's because all this that I ask for one review, I want to learn with
everyone here. I'm in the right way?
Sure, and I gave you my review. Unfortunately, for this specific patch
it is not favorable because the changes in the patch do not achieve
what is advertised in the description of the patch.

but do not be discouraged by this particular outcome... As you said,
this is an opportunity to learn and come up with better patches :-)

? My goal is to code things that are
better, even with minimal improves.
Performance improvements are a tricky business, not the first thing
you want to dive in. and 'minimal' (or not) performance improvements
should not be postulated, but measured or possibly demonstrated (less
probant).

May I suggest that you pick something in
http://wiki.documentfoundation.org/Easy_Hacks

Norbert


revol_

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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.