Permalink
Browse files

tweaks

  • Loading branch information...
simhacker
simhacker committed Jun 13, 2009
1 parent 20899b5 commit 509b0fa1573244d40e77d00ef50d6ca59c942b9c
View
@@ -39,3 +39,79 @@ When not playing game, should not poll server very fast.
Reconnect to same session, flush caches.
Clean out junk history from cities in library.
Optimize OpenLaszlo code:
http://wiki.joa-ebert.com/index.php/Avoiding_Denormals
In this example the framerate will jump from approximately 40fps to
1fps. The reason are denormal numbers. This solution is easy to
implement in ActionScript and will result in real zero values. It has
been tested successfully on
x = x + 1e-18 - 1e-18;
http://www.bigspaceship.com/blog/labs/as3-optimization-tip
This might also be expanded to do a little house cleaning while the
user isn't using the site. Once you have access to 'stage', add the
listener. Then use the functions to stop and start the site. I've left
out the project specific code and what you see here is bare
bones. MOUSE_MOVE only happens when the user is actually on the stage
so that is how we re-activate things. Thanks go out to Kirupa.
stage.addEventListener(Event.MOUSE_LEAVE, _onLeaveStage, false, 0, true);
// followed by:
private function _onLeaveStage($evt:Event):void
{
// disable site code
stage.addEventListener(MouseEvent.MOUSE_MOVE, _onReturnToStage, false, 0, true);
};
private function _onReturnToStage($evt:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, _onReturnToStage);
//re-enable site code
};
That means that the site will stop (or whatever) whenever the user
moves their mouse over the browser chrome, even if the site is still
visible right?
@Nick, maybe Event.ACTIVATE and Event.DEACTIVATE would be more
effective, not tested it yet tho ;)
Thanks for sharing this. I used the MOUSE_LEAVE event to remove an
ENTER_FRAME loop of Papervision render engine. CPU usage drops from
50% to almost 0% when mouse leaves the flash area.
i did a similar thing on a page we were doing, and if i remember
correctly, i added a MouseEvent.ROLL_OVER listener to the stage to
know when the user is back - its a bit more simple than the MOUSE_MOVE
way.
I think is better using the events ACTIVATE, dispatched when Flash
Player or an AIR application gains operating system focus and becomes
active, and DEACTIVATE, dispatched when Flash Player or an AIR
application loses operating system focus and is becoming inactive.
http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html
// this should be called as soon as your application starts up and has an open window.
// the first parameter is optional, and specifies the background fps to use (default is 1)
FramerateThrottler.initialize(2);
// set enabled to false to temporarily restore the framerate while in the background, or prevent it from reducing the framerate
// when your application moves to the background:
FramerateThrottler.enabled = false;
// you can also specify whether to only use this feature when running on a Mac:
FramerateThrottler.onlyThrottleOnMac = true;
http://www.gskinner.com/blog/assets/FramerateThrottler.zip
http://blogs.adobe.com/air/2009/05/performance_tips_for_adobe_air.html
http://arno.org/arnotify/2009/05/writing-well-behaved-efficient-air-applications/
View
@@ -0,0 +1,55 @@
Use the Python FLV screen video encoder.
http://sourceforge.net/projects/libflv/
Consider using this new Python AMF remoting library:
http://code.google.com/p/amfast/
http://drawlogic.com/2009/05/18/amfast-python-remoting-and-services-library-for-flash-flex-and-other-amf/
I am one of the developers of PyAMF.
The AmFast de/encoders are written in C, whilst Google AppEngine disables C extensions (for obvious reasons). Theoretically you could run AmFast on GAE but PyAMF would be required to do the heavy lifting (as it has a pure python option). It would be a thin wrapper at best.
PyAMF 0.4 series concentrated on stability and integration (we have good support for BigTable, Django etc.), not speed (premature optimisation being a factor).
The current development (which will become PyAMF 0.5) is focussing on speed. The current trunk is only around x2 slower than AmFast with the C extension enabled for encoding, whilst the pure python version is around x5 slower. This is a work in progress and we reckon we can get similar timings to AmFast without losing the flexibility/stability of the library.
Posted by Nick Joyce May 19th, 2009 at 4:11 am
Hi,
I’m the main developer of AmFast. Thanks for the write up.
The goal of AmFast is to create a flexible and customizable AMF and Flex messaging framework, where the encoder/decoder and transport layers are loosely coupled with the core messaging logic, so that it is easy to swap out individual components. For example, AmFast comes with a built-in C-extension for encoding/decoding AMF, but if you can’t compile the C extension, you only need a couple of extra lines of code to use the pure-Python version of PyAmf as the encoder/decoder instead.
The PyAmf/AmFast combo is more than a simple wrapper. If you’re already using PyAmf, you can continue to use PyAmf for encoding/decoding, but use AmFast’s remoting/messaging core to implement the Flex messaging features that aren’t supported by PyAmf yet (Producer/Consumer messaging, RemoteObject authentication, sessions, exposing AMF packet and Flex message objects).
I’m hoping that we can find some common ground to integrate features and code once the PyAmf project starts working on implementing Flex messaging.
In regards to the GAE question, AmFast can use the pure-Python version of PyAmf as the encoder/decoder to avoid compiling the C extension. However, AmFast’s Flex messaging implementation needs to store session information about each Flex client. Currently AmFast stores that data in memory, so Flex messaging (Producer/Consumer, RemoteObject authentication) won’t work with GAE, because memory is cleared after every request. Simple RPC calls will probably work just fine with GAE, but I haven’t tried it yet.
The next planned version of AmFast (0.4) will feature multiple back-end options for in-memory or persistent storage of connection session data (probably implemented with the Beaker package), and I hopefully will have time to cook-up a GAE example with Producer/Consumer messaging.
Posted by limscoder June 7th, 2009 at 7:13 pm
AmFast uses the standard Python logging utilities to log all request
and response messages.
# To print log messages to STDOUT
import logging
import sys
import amfast
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
amfast.logger.addHandler(handler)
# Log all request and response message objects.
amfast.log_debug = True
# Log all raw-binary AMF request and response packets (as a formatted
string).
amfast.log_raw = True
View
@@ -78,6 +78,11 @@ easy_install sqlalchemy
easy_install genshi
easy_install pyamf
svn checkout http://amfast.googlecode.com/svn/trunk/ amfast
cd amfast
python setup.py install
cd ..
wget 'http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-1_5_0_19-linux-i586-rpm.bin?BundledLineItemUUID=Ui5IBe.lLZwAAAEhIbM_57G2&OrderID=GeZIBe.lh5QAAAEhCrM_57G2&ProductID=zaJIBe.pkVcAAAEh_r8P5zJQ&FileName=/jdk-1_5_0_19-linux-i586-rpm.bin'
mv jdk-1_5_0_19-linux-i586-rpm.bin* jdk-1_5_0_19-linux-i586-rpm.bin
chmod +x jdk-1_5_0_19-linux-i586-rpm.bin
Oops, something went wrong.

0 comments on commit 509b0fa

Please sign in to comment.