>>>>> "Dov" == Dov Feldstern <[EMAIL PROTECTED]> writes:

Dov> Right now it's being called on every cursor blink, I think (I put
Dov> in a debug printout, and it prints on every blink); and what it's
Dov> doing every time is to loop over all the characters from the
Dov> beginning of the line until the current position, and sum up the
Dov> widths, in order to get to the current X position. Same thing
Dov> when you move one position to the right or to the left --- the
Dov> entire summing start from the beginning of the line. But this
Dov> calculation was already done when we painted the screen, so
Dov> there's no need to do it again.

Dov> This may not be very costly relative to the painting, but it's
Dov> certainly much more wasteful than it needs to be.

But iterating over a single line is very cheap, isn't it?

The rule is: do not try to optimize until the profiler told you that
you should do so.

JMarc

Reply via email to