<?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: Namespaces As Function Pointers</title>
	<atom:link href="http://jacksondunstan.com/articles/286/feed" rel="self" type="application/rss+xml" />
	<link>http://jacksondunstan.com/articles/286</link>
	<description>Mastering AS3</description>
	<lastBuildDate>Mon, 14 May 2012 17:02:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Simon Richardson</title>
		<link>http://jacksondunstan.com/articles/286/comment-page-1#comment-3581</link>
		<dc:creator>Simon Richardson</dc:creator>
		<pubDate>Sat, 05 Feb 2011 19:07:27 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=286#comment-3581</guid>
		<description>I didn&#039;t even notice that there is a slow down in 10.1 just calling functions (private namespace).</description>
		<content:encoded><![CDATA[<p>I didn&#8217;t even notice that there is a slow down in 10.1 just calling functions (private namespace).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Richardson</title>
		<link>http://jacksondunstan.com/articles/286/comment-page-1#comment-3580</link>
		<dc:creator>Simon Richardson</dc:creator>
		<pubDate>Sat, 05 Feb 2011 19:04:05 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=286#comment-3580</guid>
		<description>Amazingly in the 10.45.2 release player namespaces on functions are quicker than 10.1, why is there a regression?

10.1.85.3
Use namespace usage time: 327
No namespace time: 269

10.45.2
Use namespace usage time: 222
No namespace time: 244</description>
		<content:encoded><![CDATA[<p>Amazingly in the 10.45.2 release player namespaces on functions are quicker than 10.1, why is there a regression?</p>
<p>10.1.85.3<br />
Use namespace usage time: 327<br />
No namespace time: 269</p>
<p>10.45.2<br />
Use namespace usage time: 222<br />
No namespace time: 244</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Richardson</title>
		<link>http://jacksondunstan.com/articles/286/comment-page-1#comment-3579</link>
		<dc:creator>Simon Richardson</dc:creator>
		<pubDate>Sat, 05 Feb 2011 18:59:53 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=286#comment-3579</guid>
		<description>Going to test on the Flash Player 10.0 now (just downloading it) - interestingly though external namespaces for functions are about 2.1% slower than using no namespace over 50000000 iterations, which is slightly worse than variables it seems (not by much though)</description>
		<content:encoded><![CDATA[<p>Going to test on the Flash Player 10.0 now (just downloading it) &#8211; interestingly though external namespaces for functions are about 2.1% slower than using no namespace over 50000000 iterations, which is slightly worse than variables it seems (not by much though)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/286/comment-page-1#comment-3578</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Sat, 05 Feb 2011 18:50:28 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=286#comment-3578</guid>
		<description>I wonder what kind of results you&#039;d get on Flash Player 10.0. My &lt;a href=&quot;/articles/718&quot; rel=&quot;nofollow&quot;&gt;followup test&lt;/a&gt; with Flash Player 10.1 showed a 25% performance drop from the results in this article, so perhaps you&#039;re just seeing that drop in your version. One can hope, at least. :)</description>
		<content:encoded><![CDATA[<p>I wonder what kind of results you&#8217;d get on Flash Player 10.0. My <a href="/articles/718" rel="nofollow">followup test</a> with Flash Player 10.1 showed a 25% performance drop from the results in this article, so perhaps you&#8217;re just seeing that drop in your version. One can hope, at least. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Richardson</title>
		<link>http://jacksondunstan.com/articles/286/comment-page-1#comment-3577</link>
		<dc:creator>Simon Richardson</dc:creator>
		<pubDate>Sat, 05 Feb 2011 18:45:29 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=286#comment-3577</guid>
		<description>Interestingly enough, I was thinking about using an external class to hold the name space and I found something interesting. If you use an explicit usage i.e. external_namespace I get an even worse time than a Namespace variable, by about 10% - so nearly 300% worse!

Assuming you have a namespace set up called extern_namespace.as which has the following code:
&lt;pre lang=&quot;actionscript3&quot;&gt;
package
{
	public namespace extern_namespace;
}
&lt;/pre&gt;

Then testing it without the use reveals 8256ms on my 10.1 release player :-s

With the &quot;use&quot; it&#039;s the same as an Explicit namespace you tested above (see bellow). Note: you can&#039;t test it with &quot;use&quot; and &quot;explicit use&quot; (i.e. extern_namespace::val) in the same test as &quot;use&quot; as it will be used by default causing the &quot;explicit use&quot; to be the same speed as &quot;use&quot; on it&#039;s own (hope that makes sense)

&lt;pre lang=&quot;actionscript3&quot;&gt;
package
{
	import flash.display.*;
	import flash.text.*;
	import flash.utils.*;
	
	import extern_namespace;
	
	use namespace extern_namespace;
	
	public class NamespaceTest extends Sprite
	{
		
		extern_namespace var val : String = &quot;doh&quot;;

		private var val2 : String = &quot;val2&quot;;

		private var __logger : TextField = new TextField();

		public function NamespaceTest()
		{
			__logger.autoSize = TextFieldAutoSize.LEFT;
			addChild(__logger);

			var i : int;
			var s : String;
			const NUM_ITERATIONS : int = 50000000;

			// Use namespace usage
			var before : int = getTimer();
			for (i = 0; i &lt; NUM_ITERATIONS; ++i)
			{
				s = val;
				// Comment out the above line and &quot;use namespace extern_namespace;&quot; and un-comment the following line. 
				// s = extern_namespace::val;
			}
			log(&quot;Use namespace usage time: &quot; + (getTimer() - before));

			// No namespace usage
			before = getTimer();
			for (i = 0; i &lt; NUM_ITERATIONS; ++i)
			{
				s = val2;
			}
			log(&quot;No namespace time: &quot; + (getTimer() - before));
		}

		private function log(msg : *) : void
		{
			__logger.appendText(msg + &quot;\n&quot;);
		}
	}
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Interestingly enough, I was thinking about using an external class to hold the name space and I found something interesting. If you use an explicit usage i.e. external_namespace I get an even worse time than a Namespace variable, by about 10% &#8211; so nearly 300% worse!</p>
<p>Assuming you have a namespace set up called extern_namespace.as which has the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #004993;">namespace</span> extern_namespace<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then testing it without the use reveals 8256ms on my 10.1 release player :-s</p>
<p>With the &#8220;use&#8221; it&#8217;s the same as an Explicit namespace you tested above (see bellow). Note: you can&#8217;t test it with &#8220;use&#8221; and &#8220;explicit use&#8221; (i.e. extern_namespace::val) in the same test as &#8220;use&#8221; as it will be used by default causing the &#8220;explicit use&#8221; to be the same speed as &#8220;use&#8221; on it&#8217;s own (hope that makes sense)</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.*;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.*;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.*;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">import</span> extern_namespace<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    use <span style="color: #004993;">namespace</span> extern_namespace<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> NamespaceTest <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span>
    <span style="color: #000000;">&#123;</span>
&nbsp;
        extern_namespace <span style="color: #6699cc; font-weight: bold;">var</span> val <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;doh&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> val2 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;val2&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> __logger <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">TextField</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextField</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> NamespaceTest<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            __logger<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">autoSize</span> = <span style="color: #004993;">TextFieldAutoSize</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>__logger<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> s <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
            const NUM_ITERATIONS <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">50000000</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #009900; font-style: italic;">// Use namespace usage</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> before <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">int</span> = <span style="color: #004993;">getTimer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>i = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> NUM_ITERATIONS<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000066; font-weight: bold;">++</span>i<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                s = val<span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #009900; font-style: italic;">// Comment out the above line and &quot;use namespace extern_namespace;&quot; and un-comment the following line. </span>
                <span style="color: #009900; font-style: italic;">// s = extern_namespace::val;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #004993;">log</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Use namespace usage time: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">getTimer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">-</span> before<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #009900; font-style: italic;">// No namespace usage</span>
            before = <span style="color: #004993;">getTimer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>i = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> NUM_ITERATIONS<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000066; font-weight: bold;">++</span>i<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                s = val2<span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #004993;">log</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;No namespace time: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">getTimer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">-</span> before<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">log</span><span style="color: #000000;">&#40;</span>msg <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
        <span style="color: #000000;">&#123;</span>
            __logger<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">appendText</span><span style="color: #000000;">&#40;</span>msg <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;<span style="">\n</span>&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
</channel>
</rss>

