<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Vector.sortOn()?</title>
	<atom:link href="http://chargedweb.com/labs/2010/02/20/vector-sorton/feed/" rel="self" type="application/rss+xml" />
	<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/</link>
	<description>Open source projects, snippets, notes, thoughts, flash, flex, air, as3, js</description>
	<lastBuildDate>Sat, 21 Jan 2012 10:24:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: jloa</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-1172</link>
		<dc:creator>jloa</dc:creator>
		<pubDate>Mon, 21 Mar 2011 23:11:42 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-1172</guid>
		<description>well, try it to figure out why ^_^</description>
		<content:encoded><![CDATA[<p>well, try it to figure out why ^_^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wil</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-1171</link>
		<dc:creator>Wil</dc:creator>
		<pubDate>Mon, 21 Mar 2011 17:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-1171</guid>
		<description>why not just cast the vector as an array:

Array(Vector.).sortOn</description>
		<content:encoded><![CDATA[<p>why not just cast the vector as an array:</p>
<p>Array(Vector.).sortOn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jloa</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-495</link>
		<dc:creator>jloa</dc:creator>
		<pubDate>Tue, 09 Nov 2010 16:24:20 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-495</guid>
		<description>You are welcome :)
Nice to know that smbd find it useful</description>
		<content:encoded><![CDATA[<p>You are welcome <img src='http://chargedweb.com/labs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Nice to know that smbd find it useful</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Grden</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-494</link>
		<dc:creator>John Grden</dc:creator>
		<pubDate>Tue, 09 Nov 2010 15:15:53 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-494</guid>
		<description>Worked perfectly - easy to implement ;)

Thanks man,

John</description>
		<content:encoded><![CDATA[<p>Worked perfectly &#8211; easy to implement <img src='http://chargedweb.com/labs/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Thanks man,</p>
<p>John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dendy</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-171</link>
		<dc:creator>dendy</dc:creator>
		<pubDate>Fri, 06 Aug 2010 09:12:19 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-171</guid>
		<description>thanks for interesting post!</description>
		<content:encoded><![CDATA[<p>thanks for interesting post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jloa</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-65</link>
		<dc:creator>jloa</dc:creator>
		<pubDate>Sat, 24 Apr 2010 15:36:13 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-65</guid>
		<description>Well, i do have my own opinion.
To clarify, my opinion is that you always have to be practical, despite being a developer. If you are making a small project (micro web site, banner eg) you do not have to spend days optimizing every bit of your source code to get a 100 miliseconds increase in performance. As that could cause unprofitability of your project, as &quot;every project has its own solution&quot;.
You don&#039;t use Oracle databases for your forum, do you? :)

In this case you get a nice, clear method which is very handy and lightweight. And it doesn&#039;t claim to be extra-fast. Of course i wouldn&#039;t use this method in a 3d engine for massive vectors sorting etc before checking its performance.</description>
		<content:encoded><![CDATA[<p>Well, i do have my own opinion.<br />
To clarify, my opinion is that you always have to be practical, despite being a developer. If you are making a small project (micro web site, banner eg) you do not have to spend days optimizing every bit of your source code to get a 100 miliseconds increase in performance. As that could cause unprofitability of your project, as &#8220;every project has its own solution&#8221;.<br />
You don&#8217;t use Oracle databases for your forum, do you? <img src='http://chargedweb.com/labs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In this case you get a nice, clear method which is very handy and lightweight. And it doesn&#8217;t claim to be extra-fast. Of course i wouldn&#8217;t use this method in a 3d engine for massive vectors sorting etc before checking its performance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maverxkzZ</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-44</link>
		<dc:creator>maverxkzZ</dc:creator>
		<pubDate>Sat, 10 Apr 2010 06:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-44</guid>
		<description>Not bad article, but I really miss that you didn&#039;t express your opinion, but ok you just have different approach</description>
		<content:encoded><![CDATA[<p>Not bad article, but I really miss that you didn&#8217;t express your opinion, but ok you just have different approach</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jloa</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-22</link>
		<dc:creator>jloa</dc:creator>
		<pubDate>Tue, 16 Mar 2010 23:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-22</guid>
		<description>U r welcome :)
Well, yeah the method is not very &quot;politically clear&quot; if u know what i mean, BUT still it&#039;s very simple and clear as u save the &quot;sortOn&quot; construction and its native params. Yeap, i&#039;ll compare the performance and publish relsults here as soon as i rake up my current project&#039;s stuff ^_^

Btw it seems even more handy if done as a static Util class:
[code=&#039;as3&#039;]
package
{
	public class VectorUtil
	{
		/**
	 	* Converts vector to an array
		* @param	vector:*	vector to be converted
	 	* @return	Array		converted array
	 	*/
		public static function vectorToArray(vector:*):Array
		{
			var n:int = vector.length; var a:Array = new Array();
			for(var i:int = 0; i &lt; n; i++) a[i] = vector[i];
			return a;
		}
		/**
		 * Converts vector to an array and sorts it by a certain fieldName, options
		 * for more info @see Array.sortOn
		 * @param	vector:*			the source vector
		 * @param	fieldName:Object	a string that identifies a field to be used as the sort value
		 * @param	options:Object		one or more numbers or names of defined constants
		 */
		public static function sortOn(vector:*, fieldName:Object, options:Object  = null):Array
		{
			return vectorToArray(vector).sortOn(fieldName, options);
		}
	}
}
[/code]

Then the usage would be even clear:
[code=&#039;as3&#039;]
//...
var vSorted:Vector.&lt;Object&gt; = Vector.&lt;Object&gt;(VectorUtil.sortOn(v, &quot;id&quot;, Array.NUMERIC));
[/code]</description>
		<content:encoded><![CDATA[<p>U r welcome <img src='http://chargedweb.com/labs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Well, yeah the method is not very &#8220;politically clear&#8221; if u know what i mean, BUT still it&#8217;s very simple and clear as u save the &#8220;sortOn&#8221; construction and its native params. Yeap, i&#8217;ll compare the performance and publish relsults here as soon as i rake up my current project&#8217;s stuff ^_^</p>
<p>Btw it seems even more handy if done as a static Util class:</p>
<pre class="brush: as3; ">

package
{
	public class VectorUtil
	{
		/**
	 	* Converts vector to an array
		* @param	vector:*	vector to be converted
	 	* @return	Array		converted array
	 	*/
		public static function vectorToArray(vector:*):Array
		{
			var n:int = vector.length; var a:Array = new Array();
			for(var i:int = 0; i &lt; n; i++) a[i] = vector[i];
			return a;
		}
		/**
		 * Converts vector to an array and sorts it by a certain fieldName, options
		 * for more info @see Array.sortOn
		 * @param	vector:*			the source vector
		 * @param	fieldName:Object	a string that identifies a field to be used as the sort value
		 * @param	options:Object		one or more numbers or names of defined constants
		 */
		public static function sortOn(vector:*, fieldName:Object, options:Object  = null):Array
		{
			return vectorToArray(vector).sortOn(fieldName, options);
		}
	}
}
</pre>
<p>Then the usage would be even clear:</p>
<pre class="brush: as3; ">

//...
var vSorted:Vector.&lt;Object&gt; = Vector.&lt;Object&gt;(VectorUtil.sortOn(v, &quot;id&quot;, Array.NUMERIC));
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: JTtheGeek</title>
		<link>http://chargedweb.com/labs/2010/02/20/vector-sorton/comment-page-1/#comment-21</link>
		<dc:creator>JTtheGeek</dc:creator>
		<pubDate>Tue, 16 Mar 2010 21:36:18 +0000</pubDate>
		<guid isPermaLink="false">http://chargedweb.com/labs/?p=193#comment-21</guid>
		<description>This seems like a pretty rough way to go since your unboxing then reboxing the typed vector to an untyped array then back to a typed vector.   Though very simple and effective for large datasets I&#039;m guessing the performance is gonna take a pretty big hit, but depends on how Adobe implemented the vector to array conversion.   Would be great to get some performance comparisons there.  Thanks for the tip.</description>
		<content:encoded><![CDATA[<p>This seems like a pretty rough way to go since your unboxing then reboxing the typed vector to an untyped array then back to a typed vector.   Though very simple and effective for large datasets I&#8217;m guessing the performance is gonna take a pretty big hit, but depends on how Adobe implemented the vector to array conversion.   Would be great to get some performance comparisons there.  Thanks for the tip.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

