Gordon Smith wrote:
Forget StringBuilder... it's going away in B3. The player team decided
it didn't give enough performance gain in enough useful cases to justify
having both String and StringBuilder.

Doh, really?  I've actually been using it a decent amount.  It's especially handy in testing the SHA1 hash of a million letter a's to verify the hash algorithm is correct:

var millionAs:StringBuilder = new StringBuilder( '' );
millionAs.ensureCapacity( 1000000 );
for ( var i:int = 0; i < 1000000; i++ ) {
	millionAs.append( 'a' );
}
assertSHA1( millionAs.toString(), "34aa973cd4c4daa4f61eeb2bdbad27316534016f" );

I realize the above loop could be unrolled to make it perform even faster (by appending more 'a's in each append call, and reducing the number of iterations by 10x, 100x, etc).  But StringBuilder in this case was a lot faster than using a regular string.. though, I imagine this isn't really a typical use-case.

That said, however, it would be a shame to see StringBuilder go -- especially after having written a decent number of pages for it for an upcoming book.  Can I petition?  :-)

-d






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to