Flint Particle System Forum - Speed Enhancement & ColorMapping 2011-12-12T00:49:51+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=134#Comment_134 2008-05-15T13:50:15+01:00 2008-05-20T10:02:49+01:00 axel012345 http://flintparticles.org/forum/account.php?u=24 Hi everybody :) 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 ...
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 2008-05-19T15:22:21+01:00 2011-12-12T00:49:51+00:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi axel 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 ...
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 2008-05-19T18:52:19+01:00 2011-12-12T00:49:51+00:00 Richard http://flintparticles.org/forum/account.php?u=1 I've implemented the color mapping and checked it in to svn. called the methods setpixelmap and clearPixelMap since the flash docs call it a pixelMap not a colorMap. Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=156#Comment_156 2008-05-22T09:18:59+01:00 2011-12-12T00:49:51+00:00 axel012345 http://flintparticles.org/forum/account.php?u=24 Hi Richard :) 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 ...
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 2008-05-22T09:20:00+01:00 2011-12-12T00:49:51+00:00 axel012345 http://flintparticles.org/forum/account.php?u=24 A little question more , why have you replace all uint by int ? Thanks :) Thanks :)]]> Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=158#Comment_158 2008-05-23T08:07:24+01:00 2008-05-23T08:35:37+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Sorry, I miss wrote above. I called it setPaletteMap and clearPaletteMap, which matches the naming Adobe use. It is for mapping between color palettes, so calling it a color map or a palette map ...
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 2008-05-23T19:06:07+01:00 2011-12-12T00:49:51+00:00 ericr http://flintparticles.org/forum/account.php?u=17 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 ... 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 2008-05-24T09:29:33+01:00 2008-05-24T10:56:56+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Where did you find that nugget? I ran some tests. 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 2008-05-27T15:08:52+01:00 2011-12-12T00:49:51+00:00 ericr http://flintparticles.org/forum/account.php?u=17 I ran some tests. Sweet. I ran some tests.

Sweet.]]>
Speed Enhancement & ColorMapping http://flintparticles.org/forum/comments.php?DiscussionID=29&Focus=178#Comment_178 2008-05-31T21:18:59+01:00 2008-05-31T21:20:28+01:00 ericr http://flintparticles.org/forum/account.php?u=17 Came across this in my recent travels: 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 ...
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 2008-06-04T19:01:45+01:00 2011-12-12T00:49:51+00:00 Richard http://flintparticles.org/forum/account.php?u=1 More like spiffy player changes - more recent versions of the flash player are a lot faster dealing with uints. In my simple tests, int and uint were about the same speed, and Numbers were less than ...
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 2008-06-05T12:56:52+01:00 2011-12-12T00:49:51+00:00 ericr http://flintparticles.org/forum/account.php?u=17 Ahh, right. I meant to say spiffy player changes than compiler changes. And the jump from 28 to 40 fps is definitely worth it. That's two more fps worth of processing we can devote to other ... 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 2008-06-09T13:56:41+01:00 2011-12-12T00:49:51+00:00 axel012345 http://flintparticles.org/forum/account.php?u=24 Hi :) 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. ...
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 :)]]>