You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by piotrz <pi...@gmail.com> on 2015/02/20 09:27:19 UTC

[JIRA] (FLEX-34759) ArrayList performance improvements

Hi Guys,


What do you think about these patch ? It looks quite good. Could it break
something ? 

https://issues.apache.org/jira/browse/FLEX-34759

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/JIRA-FLEX-34759-ArrayList-performance-improvements-tp45186.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [JIRA] (FLEX-34759) ArrayList performance improvements

Posted by sdoolan <sh...@gmail.com>.

I re-ran the tests on a release player/swf as you suggested (I should have
thought of that), shuffled the logic to give the splice preference in the
if-else statements, and reduced the calls to 'length' with good results.

- ArrayList.addItemAt is 40x faster when adding both int's and
IEventDispatcher's at the start/end of the list.
- ArrayList.removeItemAt is 4x faster when removing items from the start of
the list, and over 200x faster at the end for both both int's and
IEventDispatcher's
- Random add/removes are marginally improved, I suspect the odd time it hits
the start or end offsets the extra logic added to check if the splice can be
avoided.

See the jira comments for a table of results and an updated patch



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/JIRA-FLEX-34759-ArrayList-performance-improvements-tp45186p45223.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [JIRA] (FLEX-34759) ArrayList performance improvements

Posted by Alex Harui <ah...@adobe.com>.
Thinking about this a bit more, it is troubling that adding a couple “if"
statements can cause a 10% performance degradation.  It occurred to me
that the degradation might be focused on this line:

        if (index == length)

And if it was rewritten as

        if (index == _source.length)

it would take 2 fewer getter fetches.  Of course there is some risk with
doing that, if someone subclassed ArrayList and overrode what the source
getter or length getter does.



Also, we should verify with the patch author that the performance numbers
were done on a release player running a release build.  Otherwise, the
sheer number of lines executed getting the length could be a factor.

-Alex

On 2/20/15, 12:55 AM, "Alex Harui" <ah...@adobe.com> wrote:

>Well, it looks like it can cause a 10% performance degradation for the
>random access case.
>
>So, I don’t like it, but not enough to veto it.  I don’t want to
>discourage folks from sharing patches that optimize performance.  Someday,
>FlexJS will have a variety of IList-type implementations, some of which
>are optimized for certain scenarios.  The Flex SDK could as well.  So
>instead of just taking the patch, some volunteers could create a
>AddItemFirstOrLastArrayList from this patch.  Or just take the patch and
>we’ll see if anyone notices.
>
>-Alex
>
>On 2/20/15, 12:27 AM, "piotrz" <pi...@gmail.com> wrote:
>
>>Hi Guys,
>>
>>
>>What do you think about these patch ? It looks quite good. Could it break
>>something ? 
>>
>>https://issues.apache.org/jira/browse/FLEX-34759
>>
>>Piotr
>>
>>
>>
>>-----
>>Apache Flex PMC
>>piotrzarzycki21@gmail.com
>>--
>>View this message in context:
>>http://apache-flex-development.2333347.n4.nabble.com/JIRA-FLEX-34759-Arra
>>y
>>List-performance-improvements-tp45186.html
>>Sent from the Apache Flex Development mailing list archive at Nabble.com.
>


Re: [JIRA] (FLEX-34759) ArrayList performance improvements

Posted by Alex Harui <ah...@adobe.com>.
Well, it looks like it can cause a 10% performance degradation for the
random access case.

So, I don’t like it, but not enough to veto it.  I don’t want to
discourage folks from sharing patches that optimize performance.  Someday,
FlexJS will have a variety of IList-type implementations, some of which
are optimized for certain scenarios.  The Flex SDK could as well.  So
instead of just taking the patch, some volunteers could create a
AddItemFirstOrLastArrayList from this patch.  Or just take the patch and
we’ll see if anyone notices.

-Alex

On 2/20/15, 12:27 AM, "piotrz" <pi...@gmail.com> wrote:

>Hi Guys,
>
>
>What do you think about these patch ? It looks quite good. Could it break
>something ? 
>
>https://issues.apache.org/jira/browse/FLEX-34759
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/JIRA-FLEX-34759-Array
>List-performance-improvements-tp45186.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.