<?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: Events vs. Callbacks</title>
	<atom:link href="http://troygilbert.com/2009/09/events-vs-callbacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://troygilbert.com/2009/09/events-vs-callbacks/</link>
	<description>Gamedev 2.0</description>
	<lastBuildDate>Mon, 23 Apr 2012 13:14:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Hays Clark</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-24831</link>
		<dc:creator>Hays Clark</dc:creator>
		<pubDate>Mon, 05 Sep 2011 19:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-24831</guid>
		<description>Interesting, this makes as lot of sense, but I think that there&#039;s another detail which is masking the truth. ( I might be wrong, but bare with me for a sec. )

Your &#039;Callback&#039; system is faster then the native Event system in tests, but this doesn&#039;t make sense because the Event system already has the upper hand.  The Event system is native &#039;Machine Code&#039; already because it&#039;s compiled into the Player and should run as fast as C code, vs your callback system is  &#039;Interpreted Code&#039; and can&#039;t run as fast as the built in player functionality.  So something else is making the Event code run SLOWER then your &#039;Interpreted Code&#039;.  I believe the Flash Players JIT is causing this slowdown.  Here is a little article about the JIT in Flash.  The key part is that Constructors remain in &#039;ActionScript Byte Code&#039; while everything else is converted to &#039;Machine Code&#039;.  It&#039;s my guess that because the Event systems heavy uses Constructors, that is the reason why the Event system is slow.  By elimination the cloning it&#039;s optimizing the slow construction of objects in Flash, however, you might also be able to speed up the Event system without having to kill the clone functionality.  A good test might be to optimize the constructors by only using and init() method and see if your performance speeds up.

http://blog.classsoftware.com/index.cfm/2010/11/4/Heavy-constructor-JIT-optimisation-in-ActionScript#c33099700-D56E-59C1-07EACFF9ED89BF3A

-Hays</description>
		<content:encoded><![CDATA[<p>Interesting, this makes as lot of sense, but I think that there&#8217;s another detail which is masking the truth. ( I might be wrong, but bare with me for a sec. )</p>
<p>Your &#8216;Callback&#8217; system is faster then the native Event system in tests, but this doesn&#8217;t make sense because the Event system already has the upper hand.  The Event system is native &#8216;Machine Code&#8217; already because it&#8217;s compiled into the Player and should run as fast as C code, vs your callback system is  &#8216;Interpreted Code&#8217; and can&#8217;t run as fast as the built in player functionality.  So something else is making the Event code run SLOWER then your &#8216;Interpreted Code&#8217;.  I believe the Flash Players JIT is causing this slowdown.  Here is a little article about the JIT in Flash.  The key part is that Constructors remain in &#8216;ActionScript Byte Code&#8217; while everything else is converted to &#8216;Machine Code&#8217;.  It&#8217;s my guess that because the Event systems heavy uses Constructors, that is the reason why the Event system is slow.  By elimination the cloning it&#8217;s optimizing the slow construction of objects in Flash, however, you might also be able to speed up the Event system without having to kill the clone functionality.  A good test might be to optimize the constructors by only using and init() method and see if your performance speeds up.</p>
<p><a href="http://blog.classsoftware.com/index.cfm/2010/11/4/Heavy-constructor-JIT-optimisation-in-ActionScript#c33099700-D56E-59C1-07EACFF9ED89BF3A" rel="nofollow">http://blog.classsoftware.com/index.cfm/2010/11/4/Heavy-constructor-JIT-optimisation-in-ActionScript#c33099700-D56E-59C1-07EACFF9ED89BF3A</a></p>
<p>-Hays</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L_B</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-24828</link>
		<dc:creator>L_B</dc:creator>
		<pubDate>Tue, 30 Aug 2011 09:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-24828</guid>
		<description>My mistake, i was too fast...sorry for the flood (you can delete our conversation below)</description>
		<content:encoded><![CDATA[<p>My mistake, i was too fast&#8230;sorry for the flood (you can delete our conversation below)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L_B</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-24827</link>
		<dc:creator>L_B</dc:creator>
		<pubDate>Tue, 30 Aug 2011 09:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-24827</guid>
		<description>The choice of your event &quot;change&quot; (Event.CHANGE) impact your first performance test.
Replace &quot;change&quot; by &quot;Change&quot; for example and you will see the difference.</description>
		<content:encoded><![CDATA[<p>The choice of your event &#8220;change&#8221; (Event.CHANGE) impact your first performance test.<br />
Replace &#8220;change&#8221; by &#8220;Change&#8221; for example and you will see the difference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy Gilbert</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-24826</link>
		<dc:creator>Troy Gilbert</dc:creator>
		<pubDate>Mon, 29 Aug 2011 16:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-24826</guid>
		<description>The choice of event name has zero impact on the discussion above.</description>
		<content:encoded><![CDATA[<p>The choice of event name has zero impact on the discussion above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L_B</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-24825</link>
		<dc:creator>L_B</dc:creator>
		<pubDate>Mon, 29 Aug 2011 12:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-24825</guid>
		<description>The problem come of the name you use for your event : &quot;change&quot; (Event.CHANGE).
If you use Event.CLEAR for exemple or a custom string you will not have this problem.
If you use &quot;change&quot;, you&#039;ll have a lot of dispatch of your event and therefore a lot of duplication i think.</description>
		<content:encoded><![CDATA[<p>The problem come of the name you use for your event : &#8220;change&#8221; (Event.CHANGE).<br />
If you use Event.CLEAR for exemple or a custom string you will not have this problem.<br />
If you use &#8220;change&#8221;, you&#8217;ll have a lot of dispatch of your event and therefore a lot of duplication i think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Csj4032</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-24815</link>
		<dc:creator>Csj4032</dc:creator>
		<pubDate>Thu, 21 Jul 2011 01:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-24815</guid>
		<description>Thanks</description>
		<content:encoded><![CDATA[<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-23849</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 22 Aug 2010 20:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-23849</guid>
		<description>You&#039;re right, see my follow-up post: http://troygilbert.com/2009/09/events-vs-callbacks-revisited/</description>
		<content:encoded><![CDATA[<p>You&#8217;re right, see my follow-up post: <a href="http://troygilbert.com/2009/09/events-vs-callbacks-revisited/" rel="nofollow">http://troygilbert.com/2009/09/events-vs-callbacks-revisited/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amy</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-23837</link>
		<dc:creator>Amy</dc:creator>
		<pubDate>Sun, 22 Aug 2010 20:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-23837</guid>
		<description>Did you verify that when you override the clone() method to return this that the &quot;listener&quot; function actually gets called?  My experiments say it doesn&#039;t (http://insideria.com/2009/12/can-event-performance-be-impro.html), which would certainly explain your increased performance when you do that :).</description>
		<content:encoded><![CDATA[<p>Did you verify that when you override the clone() method to return this that the &#8220;listener&#8221; function actually gets called?  My experiments say it doesn&#8217;t (<a href="http://insideria.com/2009/12/can-event-performance-be-impro.html" rel="nofollow">http://insideria.com/2009/12/can-event-performance-be-impro.html</a>), which would certainly explain your increased performance when you do that :).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rinn's me2DAY</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-23683</link>
		<dc:creator>rinn's me2DAY</dc:creator>
		<pubDate>Sun, 02 May 2010 09:41:33 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-23683</guid>
		<description>&lt;strong&gt;퍼플린의 생각...&lt;/strong&gt;

Event vs CallBacks - Troy Gilbert 관련 포스트를 블로그에 하나 쓸까 했으나.. 아직 언제 시간이 될지 모르것군 -ㅅ-;;;;...</description>
		<content:encoded><![CDATA[<p><strong>퍼플린의 생각&#8230;</strong></p>
<p>Event vs CallBacks &#8211; Troy Gilbert 관련 포스트를 블로그에 하나 쓸까 했으나.. 아직 언제 시간이 될지 모르것군 -ㅅ-;;;;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: troygilbert</title>
		<link>http://troygilbert.com/2009/09/events-vs-callbacks/comment-page-1/#comment-23698</link>
		<dc:creator>troygilbert</dc:creator>
		<pubDate>Fri, 19 Mar 2010 20:45:59 +0000</pubDate>
		<guid isPermaLink="false">http://troygilbert.com/?p=218#comment-23698</guid>
		<description>Go ahead, feel free to translate and post. Please just include a link back to this article (or to my homepage, &lt;a href=&quot;http://troygilbert.com/&quot; rel=&quot;nofollow&quot;&gt;http://troygilbert.com/&lt;/a&gt;). Thanks!</description>
		<content:encoded><![CDATA[<p>Go ahead, feel free to translate and post. Please just include a link back to this article (or to my homepage, <a href="http://troygilbert.com/" rel="nofollow">http://troygilbert.com/</a>). Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

