AS extension performance question...

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

AS extension performance question...

Post by Pippoflash »

Hi,
from what I have learned so far, the main performance hog in AS extensions is the fact that for each instance they have to be re-compiled in byte-code. Therefore for any game room created at runtime the extension needs to recompiled from scratch, stressing the server.

I have a question to know if an architectural choice I implemented can prevent, or at least partially prevent this.

The game room extension is only very very basic. All the logic, deck of card, game situation, game logic, etc. are instances of classes created with the middle-age styled prototype chain, that somehow works quite well.

Now here is the trick:
The classes are instantiated by zone level extensions, that live only for the purpose of providing instances, and getting them back for GC/recycling.
Therefore, the whole class is stored and instantiated in an extension that gets compiled only once.

The room extension itself will only retrieve the correct instances with something similar to:

Code: Select all

var _deck = UDeckExt.getInstance();
And once the room gets destroyed, instance is stored with:

Code: Select all

UDeckExt.storeInstance(_deck);
_deck = null;
In my perverse imagination this will prevent the compilation resource hog for AS extensions.

Does this make sense?

Also, are there other by-passable performance issues with AS extensions?

thanks
Filippo
-----------------------
www.pippoflash.com
-----------------------
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

If it's possible, you could merge all room/game extensions into a main (zone) extension which handles everything.
Smartfox's forum is my daily newspaper.
Post Reply