<?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: Free Lists</title>
	<atom:link href="http://jacksondunstan.com/articles/278/feed" rel="self" type="application/rss+xml" />
	<link>http://jacksondunstan.com/articles/278</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: 2012提升as3程序性能的十大要点 &#124; Flash开发者大会</title>
		<link>http://jacksondunstan.com/articles/278/comment-page-1#comment-24077</link>
		<dc:creator>2012提升as3程序性能的十大要点 &#124; Flash开发者大会</dc:creator>
		<pubDate>Tue, 06 Mar 2012 09:27:50 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=278#comment-24077</guid>
		<description>[...] 新的一年到来了，是时候为flash的性能制定新的解决方案了。今天的文章收集了我认为可以提升flash程序性能的十大要点。继续往下读吧。 1.使用flash的源生代码代替as3 一般情况下，使用flash player的原生代码做一些大负荷的工作要比使用as3去做好的多。因为和调用flash player api（flash包里面的所有东西）里面的方法相比，在vm（虚拟机）里运行你自己的as3代码势必会带来一些间接成本。不适用这个规则的例外是，api有时会做你不想做的事情，比如分配内存 2.减少内存分配以降低gc 除了你预料到的内存分配，比如通过使用某个新的操作触发某个事件，还有很多隐藏的分配，比如关联的字符串对象、flash player自己创建的对象，如事件。这些分配很慢，使用完了回收他们更慢，所以试着去掉这样的分配。 3.减少对象的数目以降低gc 使用完的对象，flash player的垃圾回器会回收他们的内存来重新使用。不幸的是，这个过程是非常缓慢的而且我们不能控制它什么时候执行。所以，尽量重用已经存在的对象而减少使用new来声明新的对象。对这方面有帮助的一个技术是free lists。 4.不要使用任何动态的东西 这包括动态的函数（如无特征的函数和被声明为局部变量的函数），如Object和MovieClip这样的对象，用”[]“操作符访问字段、无类型的变量。这些都比使用相应的静态量（如正规的函数、非动态类、”.”运算符、有类型的变量）要慢的多。 5.把更多的事情交给gpu 现在在flash里面（fp11）我们除了可以使用cpu外，还可以使用显卡的gpu。二者的组合使用是完成高性能3D图像处理（Stage3D）和高清视频（StageVideo）播放的关键。 6.减少函数的调用 非常不幸的是，函数调用在as3里面是非常慢的。这包括总在使用的getter和setter方法（如调用数组的长度Array.length）。尝试用缓存函数的执行结果来代替多次的函数调用，尤其是用getter的时候。在极个别情况下，手动地把一个小的函数体合并到一个更大的函数里面。 7.使用专用的函数或者类，而不是通用的 Sprite比MovieClip省内存，Shape比Sprite省内存，BitmapData的copyPixels方法比draw方法更快。 8.尽量少的使用静态访问 访问静态变量、常量和函数比访问非静态的要慢很多。尽量使用非静态方案或者把静态访问缓存为非静态变量、常量或者局部的变量、常量。 9.局部变量比字段（原文为文fields，译者认为就是所谓的成员变量）更好 读取类变量和对象变量（又叫字段，成员变量）比访问局部变量要慢地多。如果你频繁的使用某个字段访问，那么最好把它缓存为局部变量。 10.清除无意义的代码 经常见到一些变量被初始化为该类型的默认值，这会减缓对象的创造时间和函数的执行时间。作为一个好的习惯，清除那些无用代码，你的整个程序的性能将会提升。 敬请期待更多关于flash性能要点的文章。 [...]</description>
		<content:encoded><![CDATA[<p>[...] 新的一年到来了，是时候为flash的性能制定新的解决方案了。今天的文章收集了我认为可以提升flash程序性能的十大要点。继续往下读吧。 1.使用flash的源生代码代替as3 一般情况下，使用flash player的原生代码做一些大负荷的工作要比使用as3去做好的多。因为和调用flash player api（flash包里面的所有东西）里面的方法相比，在vm（虚拟机）里运行你自己的as3代码势必会带来一些间接成本。不适用这个规则的例外是，api有时会做你不想做的事情，比如分配内存 2.减少内存分配以降低gc 除了你预料到的内存分配，比如通过使用某个新的操作触发某个事件，还有很多隐藏的分配，比如关联的字符串对象、flash player自己创建的对象，如事件。这些分配很慢，使用完了回收他们更慢，所以试着去掉这样的分配。 3.减少对象的数目以降低gc 使用完的对象，flash player的垃圾回器会回收他们的内存来重新使用。不幸的是，这个过程是非常缓慢的而且我们不能控制它什么时候执行。所以，尽量重用已经存在的对象而减少使用new来声明新的对象。对这方面有帮助的一个技术是free lists。 4.不要使用任何动态的东西 这包括动态的函数（如无特征的函数和被声明为局部变量的函数），如Object和MovieClip这样的对象，用”[]“操作符访问字段、无类型的变量。这些都比使用相应的静态量（如正规的函数、非动态类、”.”运算符、有类型的变量）要慢的多。 5.把更多的事情交给gpu 现在在flash里面（fp11）我们除了可以使用cpu外，还可以使用显卡的gpu。二者的组合使用是完成高性能3D图像处理（Stage3D）和高清视频（StageVideo）播放的关键。 6.减少函数的调用 非常不幸的是，函数调用在as3里面是非常慢的。这包括总在使用的getter和setter方法（如调用数组的长度Array.length）。尝试用缓存函数的执行结果来代替多次的函数调用，尤其是用getter的时候。在极个别情况下，手动地把一个小的函数体合并到一个更大的函数里面。 7.使用专用的函数或者类，而不是通用的 Sprite比MovieClip省内存，Shape比Sprite省内存，BitmapData的copyPixels方法比draw方法更快。 8.尽量少的使用静态访问 访问静态变量、常量和函数比访问非静态的要慢很多。尽量使用非静态方案或者把静态访问缓存为非静态变量、常量或者局部的变量、常量。 9.局部变量比字段（原文为文fields，译者认为就是所谓的成员变量）更好 读取类变量和对象变量（又叫字段，成员变量）比访问局部变量要慢地多。如果你频繁的使用某个字段访问，那么最好把它缓存为局部变量。 10.清除无意义的代码 经常见到一些变量被初始化为该类型的默认值，这会减缓对象的创造时间和函数的执行时间。作为一个好的习惯，清除那些无用代码，你的整个程序的性能将会提升。 敬请期待更多关于flash性能要点的文章。 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/278/comment-page-1#comment-831</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Wed, 15 Sep 2010 21:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=278#comment-831</guid>
		<description>Yes, but you have to hold the objects somehow. This is why I tried two linked list approaches as well as &lt;code&gt;Vector&lt;/code&gt;. Do you have an alternate collection to suggest?</description>
		<content:encoded><![CDATA[<p>Yes, but you have to hold the objects somehow. This is why I tried two linked list approaches as well as <code>Vector</code>. Do you have an alternate collection to suggest?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henke37</title>
		<link>http://jacksondunstan.com/articles/278/comment-page-1#comment-829</link>
		<dc:creator>Henke37</dc:creator>
		<pubDate>Wed, 15 Sep 2010 19:16:58 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=278#comment-829</guid>
		<description>Toss out the list requirement and you are describing an object pool.</description>
		<content:encoded><![CDATA[<p>Toss out the list requirement and you are describing an object pool.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/278/comment-page-1#comment-678</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Tue, 15 Jun 2010 16:45:54 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=278#comment-678</guid>
		<description>Cool! This is one I&#039;m definitely going to re-test with Flash Player 10.1.</description>
		<content:encoded><![CDATA[<p>Cool! This is one I&#8217;m definitely going to re-test with Flash Player 10.1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Promethe</title>
		<link>http://jacksondunstan.com/articles/278/comment-page-1#comment-675</link>
		<dc:creator>Promethe</dc:creator>
		<pubDate>Tue, 15 Jun 2010 15:14:04 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=278#comment-675</guid>
		<description>Hello jackson!

I noticed that in Flash 10.1, the Flash player actually releases the garbage collected memory.

It works in both the desktop player and in the browser. And Sytem.gc() is now working perfectly fine!

Regards,</description>
		<content:encoded><![CDATA[<p>Hello jackson!</p>
<p>I noticed that in Flash 10.1, the Flash player actually releases the garbage collected memory.</p>
<p>It works in both the desktop player and in the browser. And Sytem.gc() is now working perfectly fine!</p>
<p>Regards,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/278/comment-page-1#comment-26</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Wed, 16 Sep 2009 20:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=278#comment-26</guid>
		<description>Thanks for your comment. I think using an array would be just like using a vector, only slower. Did you have something in mind about arrays that would make them faster in this instance than vectors? If so, I&#039;d love to hear it. Thanks again.</description>
		<content:encoded><![CDATA[<p>Thanks for your comment. I think using an array would be just like using a vector, only slower. Did you have something in mind about arrays that would make them faster in this instance than vectors? If so, I&#8217;d love to hear it. Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy Gilbert</title>
		<link>http://jacksondunstan.com/articles/278/comment-page-1#comment-21</link>
		<dc:creator>Troy Gilbert</dc:creator>
		<pubDate>Wed, 16 Sep 2009 19:49:31 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=278#comment-21</guid>
		<description>Would using an array instead of a linked-list keep from having to use the intermediate free list node to wrap your allocated object? Would that allow for a compromise between the &quot;recycling&quot; linked-list and linked-list performances?

I&#039;m thinking along these lines: treat the array like a stack, push freed (or recycled) objects onto it, pop them off to allocate.</description>
		<content:encoded><![CDATA[<p>Would using an array instead of a linked-list keep from having to use the intermediate free list node to wrap your allocated object? Would that allow for a compromise between the &#8220;recycling&#8221; linked-list and linked-list performances?</p>
<p>I&#8217;m thinking along these lines: treat the array like a stack, push freed (or recycled) objects onto it, pop them off to allocate.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

