Flint Particle System Forum - Speed Enhancement & ColorMapping Mon, 12 Dec 2011 00:22:03 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=134#Comment_134 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=134#Comment_134 Thu, 15 May 2008 13:50:15 +0100 axel012345
So first Flint is very nice , a lot of power and possibility , it's magic.
I have start to work with it, and it's very fun to do so.
The framework is young for the moment but the base is here and some stuff too :) . Let's continue !

I suggest just some little change :) for speed enhancement .

Maybe you have read too http://je2050.de/files/misc/as3opt.pdf

I have see this :

1- 2D loops
Iterations Cycle[ms] Simple for[ms]
1024^2 95.4 106.3
2048^2 355.8 738.6

So in many iterations a we keep a lot of time , maybe do test too to check and verify this time.
But it's can be use when we loop on particle in Emitter.

2- Not enhancement of book :
It's can be nice to have access at paletteMap of BitmapData in BitmapRenderer

Like this
len = _postFilters.length;
for( i = 0; i < len; ++i )
{
_bitmap.bitmapData.applyFilter( _bitmap.bitmapData, _bitmap.bitmapData.rect, ORIGIN_POINT, _postFilters[i] );
}

if( _aColorMapping.length > 0 )
_bitmap.bitmapData.paletteMap( _bitmap.bitmapData, _bitmap.bitmapData.rect, ORIGIN_POINT, _aColorMapping[1] , _aColorMapping[2] , _aColorMapping[3] , _aColorMapping[0] );
_bitmap.bitmapData.unlock();

and to use it a simple setter
public function setColorMapping( alpha : Array = null , red : Array = null , green : Array = null , blue : Array = null ) : void
{
_aColorMapping = new Array(4);
_aColorMapping[0] = alpha ? alpha : [] ;
_aColorMapping[1] = red ? red : [];
_aColorMapping[2] = green ? green : [] ;
_aColorMapping[3] = blue ? blue : [];
}

Yes color mapping not an enhancement lol but vey nice effect can be done with it , i think it's a "base" tool for graphic possibility and you.
3- In renderParticles of BitmapRenderer we have a lot of new Point( 0 , 0 ) , i have replace it by a static const ORIGIN_POINT in class .
Each frame update we have 4 or 3 don't remember Point create for nothing, so now more clean.


It's really enhancement and base file i have modify, in flint.
It's very important that Flint be Fast as possible.

Axel ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=139#Comment_139 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=139#Comment_139 Mon, 19 May 2008 15:22:21 +0100 Richard
1. When looping over the particles in the emitter, our inner loop is over as many items as the number of particles. However, the outer loop is over the actions, which is usually a very small number. So rather than being 1024*1024, it's more like 6*2000 (actions * particles), so I doubt there will be a speed up (although I haven't tried it - have you?).

2. I haven't used color maps before so hadn't thought to include them. I'll check them out and add them very soon - your code looks like a sensible way to do it. Will let you know when it's in SVN.

3. Yes - an obvious optimisation that I missed. Thank you. It's now in SVN (although I used the name ZERO_POINT for the static variable - I think it's clearer). ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=146#Comment_146 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=146#Comment_146 Mon, 19 May 2008 18:52:19 +0100 Richard Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=156#Comment_156 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=156#Comment_156 Thu, 22 May 2008 09:18:59 +0100 axel012345
1. no but i will :) and keep in touch

2. Thanks for add it in speed way :D , but for the name and parameter , i think a framework is another layer between flash and user , if we can simplify and make it more clear , it's good.
The point is that the color mapping , in name in photoshop a color mapping , not a pixel , but yes it touch all pixel so it's not false, but the most clear is colorMapping, because it's what it does.
Another thing, i think setColorMap parameter must start with alpha and keep the ARGB model , the flash function paletteMap not respect this rule , don't do like them .

3. No problem :) , it's fine for me . Moreee powaa lol :)


Another time , thanks for your time :) to read , to enhance and to speak :) ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=157#Comment_157 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=157#Comment_157 Thu, 22 May 2008 09:20:00 +0100 axel012345 Thanks :) ]]> Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=158#Comment_158 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=158#Comment_158 Fri, 23 May 2008 08:07:24 +0100 Richard
I don't know why I called the internal property _colorMap - either this should change to _paletteMap or the methods should change to setColorMap and clearColorMap. I propose the former but would value your opinion.

I placed the alpha last in the parameter list because it allows users to use the method with just three parameters for an RGB map and four for ARGB. This, I think, is also why Adobe do this. It's a difficult (although admittedly minor) choice. Given my reason, do you still think it should be the other way around?

P.S. I changed uint to int because it is very slightly faster on the current flash player. ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=161#Comment_161 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=161#Comment_161 Fri, 23 May 2008 19:06:07 +0100 ericr I changed uint to int because it is very slightly faster on the current flash player.

Where did you find that nugget? Is there a write-up somewhere?

I used uint wherever I could specifically because I thought it would be better optimized than or, at the very least, equal to int in performance terms. Weird. ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=163#Comment_163 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=163#Comment_163 Sat, 24 May 2008 09:29:33 +0100 Richard Where did you find that nugget?

I ran some tests. ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=176#Comment_176 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=176#Comment_176 Tue, 27 May 2008 15:08:52 +0100 ericr I ran some tests.

Sweet. ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=178#Comment_178 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=178#Comment_178 Sat, 31 May 2008 21:18:59 +0100 ericr
http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html

Wow. If those tests haven't changed due to some spiffy compiler changes made by Adobe in the two years since that article was penned I'm going to say "bye bye" to uints (and even, in many cases, ints)! ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=182#Comment_182 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=182#Comment_182 Wed, 04 Jun 2008 19:01:45 +0100 Richard
Talking of which, it's pleasing to note that the first ever version of the gravity wells example (before Flint was released) ran at 8fps with 1,000 particles. The first public version ran 5,000 particles at 30fps. Now it's 20,000 particles at 40fps. (all on the same computer). By my reckoning that's a 100x speed increase overall. Some of it is likely down to improvements in the flash player, but most of it is down to code optimizations. (The Flex profiler was invaluable.) ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=189#Comment_189 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=189#Comment_189 Thu, 05 Jun 2008 12:56:52 +0100 ericr physics)!

And those are some extremely impressive speed increases. I've definitely noticed a fantastic increase in speed since I started toying with Flint back in the pre 1.0 days. Great work!

A year old today but your mention of the value of the Flex profiler led me to a google search page yielding this. Damn that looks impressive. I currently use FlashDevelop and CS3 for my dev environment but that profiler is certainly enticing. ]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=203#Comment_203 http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=203#Comment_203 Mon, 09 Jun 2008 13:56:41 +0100 axel012345
For me it's more clear for people to have setColorMap for name , we change color with this , so it's logic, i don't care about adobe stuff, must do site for change sound api lol.
And too for the ARGB it's just a way to be more clear and be near the standard. To have the alpha at first is more clear, in this case , because we can change it.

Welcome after to the flash player 10 and powa lol :)

Thanks for your time :) ]]>