<?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: Actionscript 3 Find and Replace String Performance Comparison</title>
	<atom:link href="http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/</link>
	<description>All things web dev, from design to deployment (and EVERYTHING in between).</description>
	<pubDate>Thu, 11 Mar 2010 05:14:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tim McLeod</title>
		<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/comment-page-1/#comment-829</link>
		<dc:creator>Tim McLeod</dc:creator>
		<pubDate>Tue, 22 Sep 2009 12:18:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.blogna.org/blog/?p=333#comment-829</guid>
		<description>Cool, thanks!</description>
		<content:encoded><![CDATA[<p>Cool, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike chambers</title>
		<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/comment-page-1/#comment-828</link>
		<dc:creator>mike chambers</dc:creator>
		<pubDate>Tue, 22 Sep 2009 07:36:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.blogna.org/blog/?p=333#comment-828</guid>
		<description>fyi

This has been updated in the library:

http://code.google.com/p/as3corelib/issues/detail?id=87

thanks for the help...

mike chambers</description>
		<content:encoded><![CDATA[<p>fyi</p>
<p>This has been updated in the library:</p>
<p><a href="http://code.google.com/p/as3corelib/issues/detail?id=87" rel="nofollow">http://code.google.com/p/as3corelib/issues/detail?id=87</a></p>
<p>thanks for the help&#8230;</p>
<p>mike chambers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Herman</title>
		<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/comment-page-1/#comment-818</link>
		<dc:creator>Tim Herman</dc:creator>
		<pubDate>Tue, 23 Jun 2009 21:20:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.blogna.org/blog/?p=333#comment-818</guid>
		<description>You're using quite a small string.  I would try the replaces on much larger strings and see what kind of results you get.  The two implementations may not have linear performance with respect to the length of the string.</description>
		<content:encoded><![CDATA[<p>You&#8217;re using quite a small string.  I would try the replaces on much larger strings and see what kind of results you get.  The two implementations may not have linear performance with respect to the length of the string.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Christiansen</title>
		<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/comment-page-1/#comment-752</link>
		<dc:creator>Ryan Christiansen</dc:creator>
		<pubDate>Thu, 22 Jan 2009 18:52:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.blogna.org/blog/?p=333#comment-752</guid>
		<description>As a follow up, it takes ~175ms to create the previous instance of RegExp 50,000 times. So if it were possible to reuse the same RegExp instance, it could be marginally faster than the split/join.

Both of the following declarations are identical.

// This is the shorthand form
var regExp:RegExp = /moon/g;

// This is the full class form
var regExp:RegExp = new RegExp("moon", "g");</description>
		<content:encoded><![CDATA[<p>As a follow up, it takes ~175ms to create the previous instance of RegExp 50,000 times. So if it were possible to reuse the same RegExp instance, it could be marginally faster than the split/join.</p>
<p>Both of the following declarations are identical.</p>
<p>// This is the shorthand form<br />
var regExp:RegExp = /moon/g;</p>
<p>// This is the full class form<br />
var regExp:RegExp = new RegExp(&#8221;moon&#8221;, &#8220;g&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Christiansen</title>
		<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/comment-page-1/#comment-751</link>
		<dc:creator>Ryan Christiansen</dc:creator>
		<pubDate>Thu, 22 Jan 2009 18:46:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.blogna.org/blog/?p=333#comment-751</guid>
		<description>As a third comparison, I did some benchmarking of find/replace via regular expressions. You may have seen the native String method 'replace()':

myString.replace(pattern:*, repl:Object):String

This is an extremely powerful find and replace method allowing searches ignoring case, multiple group matches that can be used as parameters in the replace text, etc. (It's all well documented in the Flash help).

In short i was able to do the same find and replace using regular expressions like this...

str.replace(/moon/g, "fence");

The 'g' flag is important so that it replaces ALL matches of "moon" and not just the first one. You could also use the 'i' flag to perform a find/replace as case insensitive.

There are likely performance differences between our boxes, but here's my results:

Split Join: ~475 ms
Regular Expressions: ~625 ms

I would consider that pretty small for the power that comes with it.</description>
		<content:encoded><![CDATA[<p>As a third comparison, I did some benchmarking of find/replace via regular expressions. You may have seen the native String method &#8216;replace()&#8217;:</p>
<p>myString.replace(pattern:*, repl:Object):String</p>
<p>This is an extremely powerful find and replace method allowing searches ignoring case, multiple group matches that can be used as parameters in the replace text, etc. (It&#8217;s all well documented in the Flash help).</p>
<p>In short i was able to do the same find and replace using regular expressions like this&#8230;</p>
<p>str.replace(/moon/g, &#8220;fence&#8221;);</p>
<p>The &#8216;g&#8217; flag is important so that it replaces ALL matches of &#8220;moon&#8221; and not just the first one. You could also use the &#8216;i&#8217; flag to perform a find/replace as case insensitive.</p>
<p>There are likely performance differences between our boxes, but here&#8217;s my results:</p>
<p>Split Join: ~475 ms<br />
Regular Expressions: ~625 ms</p>
<p>I would consider that pretty small for the power that comes with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim McLeod</title>
		<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/comment-page-1/#comment-750</link>
		<dc:creator>Tim McLeod</dc:creator>
		<pubDate>Thu, 22 Jan 2009 17:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.blogna.org/blog/?p=333#comment-750</guid>
		<description>Will do.  Thanks.</description>
		<content:encoded><![CDATA[<p>Will do.  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike chambers</title>
		<link>http://www.blogna.org/blog/adobe-flash/actionscript-3-find-and-replace-string-performance-comparison/comment-page-1/#comment-749</link>
		<dc:creator>mike chambers</dc:creator>
		<pubDate>Thu, 22 Jan 2009 16:21:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.blogna.org/blog/?p=333#comment-749</guid>
		<description>Thanks for doing the test. If you can log a bug with the issue (on the project page), then we can look at replacing the method with your code.

mike chambers

mesh@adobe.com</description>
		<content:encoded><![CDATA[<p>Thanks for doing the test. If you can log a bug with the issue (on the project page), then we can look at replacing the method with your code.</p>
<p>mike chambers</p>
<p><a href="mailto:mesh@adobe.com">mesh@adobe.com</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
