Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> Hello, This simple optimization bring (subjectively) 1
Abdelrazak> second in the scroll test. I think it is a safe and non
Abdelrazak> controversial improvement so I will commit now.

It looks safe indeed. You should also (for readability and speed)
constify variables

-       CoordCache::InnerParPosCache parPos = theCoords.parPos()[text];

This line is wrong it should be

- CoordCache::InnerParPosCache & parPos = theCoords.parPos()[text];

I have corrected that now. Looks like I am working with too many trees...

+       CoordCache::InnerParPosCache const & const parPos = 
theCoords.parPos()[text];

But parPos is modified in the loop so cannot be const.


-       Paragraph & par = text->getPar(pit);
+       Paragraph const & const par = text->getPar(pit);

Same here.


(OK, I may have added too many consts, but they do help the compiler
to generate better code, and it makes the intent of the code clearer)

Hum are you sure about that? Msvc gives me this:

D:\devel\lyx\trunk2\src\BufferView_pimpl.C(1418) : warning C4227: anachronism used : qualifiers on reference are ignored D:\devel\lyx\trunk2\src\BufferView_pimpl.C(1420) : warning C4227: anachronism used : qualifiers on reference are ignored D:\devel\lyx\trunk2\src\BufferView_pimpl.C(1422) : error C2678: binary '[' : no operator found which takes a left-hand operand of type 'const CoordCache::InnerParPosCache' (or there is no acceptable conversion) C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\map(166): could be 'Point &std::map<_Kty,_Ty>::operator [](__w64 const int &)'
        with
        [
            _Kty=lyx::pit_type,
            _Ty=Point
        ]
while trying to match the argument list '(const CoordCache::InnerParPosCache, lyx::pit_type)'



Reply via email to