Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you need super-fast sorting, then it might be worthwhile not using an array at all and instead using a linked-list. There are different advantages to each. Primarily, with a linked-list, index-access is slow, while iterating through the list is fast, and linked-lists are not native to AS3 so you'll have to roll your own.</p> <p>On the upside, you may well be able to use some of Polygonal Labs' code: <a href="http://lab.polygonal.de/as3ds/" rel="nofollow">http://lab.polygonal.de/as3ds/</a>.</p> <p>Sorting is very, very fast for nearly-sorted data with a linked list, as this article discusses: <a href="http://lab.polygonal.de/2007/11/26/data-structures-more-on-linked-lists/" rel="nofollow">http://lab.polygonal.de/2007/11/26/data-structures-more-on-linked-lists/</a>.</p> <p>This solution gives you lots more work, but will eventually give you lots more sort-speed too.</p> <p>Hope this helps.</p> <p>-- additional --</p> <p>I noticed your question in the comments of another answer about "One question however is unanswered - how to perform greedy computations in Flash without hanging it?"</p> <p>For this, essentially the answer is to break your computation over multiple frames, something like this:</p> <pre><code>public function sort():void { addEventListener(Event.ENTER_FRAME, iterateSort); } private function iterateSort():void { var time:int = getTimer() + TARGET_MILLISECONDS_PER_FRAME; var isFinished:Boolean = false; while (!isFinished &amp;&amp; getTimer() &lt; time) isFinished = continueSort(); if (isFinished) removeEventListener(Event.ENTER_FRAME, iterateSort); } function continueSort():Boolean { ... implement an 'atom of sort' here, whatever that means ... } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload