classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] RFC: GapContent Position adjusting performance improvement


From: Anthony Balkissoon
Subject: [cp-patches] RFC: GapContent Position adjusting performance improvement
Date: Fri, 30 Sep 2005 10:27:42 -0400

This patch is meant to improve the performance of GapContent when the
Positions need to be adjusted.  Since getPositionsInRange already
involves iterating over the range of Positions, calling this method and
then iterating over the set it produced to act on those Positions is
really iterating twice over the same set.  Therefore I wrote
setPositionsInRange and adjustPositionsInRange to perform common actions
on a set of Positions.  It's the same code as getPositionsInRange, but
rather than return the set, the operation (either setting the marks or
adjusting them) is performed within the one and only iteration.

This is sent as RFC because I have no benchmarks to actually show that
it does improve performance, although it seems quite intuitive.

OK to commit?

2005-09-30  Anthony Balkissoon  <address@hidden>

        * javax/swing/text/GapContent.java:
        (shiftEnd): Call adjustPositionsInRange rather than getPositionsInRange
        and then iterating over the set and adjusting them.
        (shiftGap): Likewise.
        (shiftGapStartDown): Call setPositionsInRange rather than
        getPositionsInRange and then iterating over the set to set each
        Position.
        (shiftGapEndUp): Likewise.
        (setPositionsInRange): New implementation method.
        (adjustPositionsInRange): New implementation method.
        (resetMarksAtZero): Call setPositionsInRange rather than 
        getPositionsInRange and then iterating over the set to set each
        Position.

--Tony





reply via email to

[Prev in Thread] Current Thread [Next in Thread]