# Need some help optimizing this

**URL:** <https://forum.kirupa.com/t/need-some-help-optimizing-this/290088>\
**Category:** flash\
**Created:** [June 9, 2009, 4:46pm UTC](https://forum.kirupa.com/t/need-some-help-optimizing-this/290088 "2009-06-09T16:46:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![koolkrasher](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@koolkrasher](https://forum.kirupa.com/u/koolkrasher)\
**Post date:** [June 9, 2009, 4:46pm UTC](https://forum.kirupa.com/t/need-some-help-optimizing-this/290088/1 "2009-06-09T16:46:49Z")

</div>

I found a tutorial on how to make a cool water effect in as3 using bitmap data and a displacemnt filter. It works great but it is very heavy on the computer.

here is my code

```auto

var bmd:BitmapData = new BitmapData(700, 398);
var dmf:DisplacementMapFilter = new DisplacementMapFilter(bmd, new Point(0,0), 1, 2, 10, 30);
var p1:Point = new Point(0, 0);
var p2:Point = new Point(0, 0);
var perlinOffset:Array = [p1, p2];

addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void {
    perlinOffset[0].x += 0.8;
    perlinOffset[1].y += -0.6;
    bmd.perlinNoise(168, 5, 2, 4, true, true, 2, true, perlinOffset);
    orig_mc.filters=[dmf];
}

```

Here is a liink to the swf  
[anthonydevito.net/bcLawn/flash/water.swf](http://anthonydevito.net/bcLawn/flash/water.swf)

Any one have any ideas on how to speed this up?
