Flint Particle System Forum - Performance decrease in newer versions of Flint? 2016-06-02T18:17:23+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Performance decrease in newer versions of Flint? http://flintparticles.org/forum/comments.php?DiscussionID=584&Focus=1989#Comment_1989 2013-01-11T16:46:53+00:00 2016-06-02T18:17:23+01:00 TomAuger http://flintparticles.org/forum/account.php?u=650 I have an old project from 2008 of an extremely simple nature - it uses a PixelRenderer as a mask to reveal a MovieClip on stage. I have tried to port this old code to the latest version of Flint ...
I have tried to port this old code to the latest version of Flint (4.x) and am very surprised that it _appears_ to run a lot slower. I would have imagined that more recent versions would be more performant, if anything, not less. So I assume there may be something wrong with what I'm doing now that wasn't wrong 5 years ago.

Here's the old code:


var renderer:BitmapRenderer;
var emitter:Emitter;

var mc_pic:MovieClip;

public function Main() {
addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init( event:Event ) {
mc_pic = this.getChildByName( "picMC" ) as MovieClip;
mc_pic.cacheAsBitmap = true;

renderer = new PixelRenderer( new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight ) );
renderer.addFilter( new BlurFilter( 6, 6, 1 ), true );
renderer.cacheAsBitmap = true;

emitter = new Emitter();
emitter.renderer = renderer;
emitter.counter = new Steady( 10000 );

emitter.addInitializer( new Position( new RectangleZone( mc_pic.x, mc_pic.y, mc_pic.x + mc_pic.width, mc_pic.y + mc_pic.height ) ) );

emitter.addInitializer( new Velocity( new DiscZone( new Point( 0, 0 ), 5, 20 ) ) );
emitter.addAction( new Move() );

emitter.start();

addChild( renderer );
mc_pic.mask = renderer;
}


And here's the updated version:


var renderer:BitmapRenderer;
var emitter:Emitter;

var mc_pic:MovieClip;

public function Main() {
addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init( event:Event ) {
mc_pic = this.getChildByName( "picMC" ) as MovieClip;
mc_pic.cacheAsBitmap = true;

renderer = new PixelRenderer( new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight ) );
renderer.addFilter( new BlurFilter( 6, 6, 1 ), true );
renderer.cacheAsBitmap = true;

emitter = new Emitter2D();
emitter.counter = new Steady( 10000 );

emitter.addInitializer( new Position( new RectangleZone( mc_pic.x, mc_pic.y, mc_pic.x + mc_pic.width, mc_pic.y + mc_pic.height ) ) );

emitter.addInitializer( new Velocity( new DiscZone( new Point( 0, 0 ), 20, 5 ) ) );
emitter.addAction( new Move() );

renderer.addEmitter( emitter );
emitter.start();

addChild( renderer );
mc_pic.mask = renderer;
}
]]>
Performance decrease in newer versions of Flint? http://flintparticles.org/forum/comments.php?DiscussionID=584&Focus=1998#Comment_1998 2013-01-20T12:34:35+00:00 2016-06-02T18:17:23+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi Tom I don't see anything wrong with your code. I too am surprised it runs a lot slower. Updates to Flint have usually been to add features rather than to improve performance, but with each new ...
I don't see anything wrong with your code. I too am surprised it runs a lot slower. Updates to Flint have usually been to add features rather than to improve performance, but with each new feature I tried to offset any resulting slowdown with performance improvements elsewhere. I wouldn't expect your project to be a lot slower (a little maybe).

Sorry I can't help more.
Richard]]>
Performance decrease in newer versions of Flint? http://flintparticles.org/forum/comments.php?DiscussionID=584&Focus=2002#Comment_2002 2013-01-24T04:34:27+00:00 2016-06-02T18:17:23+01:00 TomAuger http://flintparticles.org/forum/account.php?u=650 There are only so many hours in the day! I wish I had a deeper understanding of optimization in an AS3 context, or I would offer to help.