classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] Re: RFC: GapContent Position adjusting performance improvem


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

Forgot to attach the patch, here it is.

--Tony

On Fri, 2005-09-30 at 10:27 -0400, Anthony Balkissoon wrote:
> 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

Attachment: GapContentPositionsPerformanceBoost.diff
Description: Text Data


reply via email to

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