Good news everyone. The Apparat inline expansion works now to full extent after fixing some minor bugs. A complete example is also available. Just change the paths in the build.properties file and compile everything using Ant.

Use the inline feature with care. Apparat does not try to optimize your code and performs nothing but dead simple inlining. This can lead to slower code due to the creation of lots of local registers. Your code gets also much bigger and will require more space in memory. I am actually not a fan of manual inlining at all. I think it makes only sense to inline code if you have a powerful optimizer available that will cleanup the whole mess.
The fun story about this example is that the inlined version is slower using the lastes Flash Player release candidate if you have only 40.000 particles. That is why I increased the number of particles to 80.000 ;). I developed the example using an old standalone player and the inlined version was nearly twice as fast. However when I watched the example in the browser with the latest release candidate the game was completely different. Kudos to Adobe for significantly improving the Flash Player performance!
23 Comments
Hmm I have version 10,1,52,14 and on my home PC inline version runs slower(37FPS) then AS3 version(40FPS).
Adding some input to add/remove particles would allow to test it more extensively.
About which version of Flash you are speaking about precisely?
Hi Joa,
You are probably interested in some results on different machines.
in response to wonder why-er: on the mac i got different results:
as3: 20 fps (average)
inline: 31 fps (average)
i run player 10,1,53,38 (debug version)
so inlining gave more than 50% performance boost,
awesome!
Arnoud
Decided to add more information just in case
Win7 IE8 not-debug player 10,1,51,95
AS3 35fps
Inline 45fps
Version where I checked yesterday, today results
Win7 FireFox 3.6.3 debug player 10,1,52,14
AS3 17fps
Inline 30fps
Interesting that they are different from yesterday, over checked if I have anything else running in other tabs like banners and today there is no such things so I guess yesterdays may have been wrong. Inline version clearly is faster today :)
Would be cool if you could make some Flash that loads both Inline/AS3 versions, runs them, sends statistic to server with information about OS/Browser/Flash Version and then output it publicly in a way that we could see how they perform on average on different systems :)
Webkit recent, OSX 10.6.3, Flash Player 10.1 rc6 nodebug:
AS3 30fps
Inline 40FPS
Hi,
I compiled the demo but I have a warning:
“7z is not present on PATH. Fallback to normal compression.”
I’ve downloaded 7zX and found the executable 7za in /Contents/Resources/
I tried to copy all that stuff in the root of apparat, but I still get the warning.
Should I somehow referenced the 7za file to apparat?
Romu
Apparat searches currently only for “7z” and not “7za” on the path. I will fix that for Linux systems.
And yes: you can reference the 7za file directly by specifying “-Dapparat.7z.path=path to your 7za executable”
Do you have an API of apparat where I can find information about BitMacro, FastMath, IntMath, etc …
All classes and methods are fully documented. The macros are also documented on the wiki at apparat.googlecode.com.
How do you use this with flash develop? Anybody got a walkthrough?
Awesome job! For years you offer “awww”s and “oohhh”s… thanks!
I guess if use Pixel Bender could be event fast than inline
I’ve got 7z compile on OSX and I threw it into /usr/sbin. When I run reducer I still get [WARNING] 7z is not present on PATH. Fallback to normal compression.
Any Ideas?
D’oh! Just figured it out. Renamed 7z back to 7za. :D
I completed this tutorial to use apparat to build this example: http://webdevotion.be/blog/2010/06/02/how-to-get-up-and-running-with-apparat/
I was able to generate the two .swf files “example-as3.swf” and “example-apparat.swf” with the following versions of Apparat and Scala:
Apparat: “apparat-aggregator-1.0.RC6″
Scala: “scala-2.8.0.final”
Everything seems to work great during the build process, I even got it working w/Flash Builder and the Eclipse Ant plugin.
example-as3.swf works fine (slow as heck) but
example-apparat.swf gives me this error when I run it:
ReferenceError: Error #1056: Cannot create property domainMemory on flash.system.ApplicationDomain.
at apparat.memory::Memory$/select()[/home/joa/Development/apparat-release/target/checkout/apparat-ersatz/src/main/as3/apparat/memory/Memory.as:64]
at ExampleApparat/init()
at ExampleApparat()
I tried running tdsi both in the ant script and from the command line with the following arguments (based on what I could gather from the apparat README)
tdsi -i example-apparat.swf -f true -a true -e true -m true
tdsi -i example-apparat.swf -f
No-dice in all cases, running the .swf produces the above exceptions. Any ideas?
I’m dumb. I used the wrong sdk version. Everything works with 4.1, I get that exception w/3.5.
Aaron,
the problem was not in sdk.
-target-player 10 was optional in 3.5, and must be for apparat compilation.
Hm, i tried to follow the steps from http://webdevotion.be/blog/2010/06/02/how-to-get-up-and-running-with-apparat/ but i get the following error when I run ant to compile example-apparat:
[tdsi] java.lang.VerifyError: (class: apparat/tools/tdsi/TurboDieselSportInjection$TDSITool, method: run signature: ()V) Incompatible argument to
function
[tdsi] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
[tdsi] at …
[tdsi] Java Result: -1
Hi Joa,
I tried steps as in the link http://webdevotion.be/blog/2010/06/02/how-to-get-up-and-running-with-apparat/
But i get below error,
Buildfile: D:\workspace\apparatTest\build\build.xml
BUILD FAILED
D:\workspace\apparatTest\build\build.xml:52: The following error occurred while executing this line:
jar:file:/C:/apparat/apparat.jar!/apparat/embedding/ant/antlib.xml:22: typedef A class needed by class apparat.embedding.ant.stripper.StripperTask cannot be found: scala/ScalaObject
One person in the comments section faced similar issue, but his fix did not solve issue with my trial.
Below are my path settings,
FLEX_HOME=C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0
APPARAT_HOME=D:/apparat-ant-example/apparat
SCALA_HOME=D:/apparat-ant-example/scala-2.8.0.RC3/bin
Any help is greatly appreciated.
Thanks,
srayker
Hi Joa,
The earlier issue got resolved by removing /bin in scala_home, my err.
But i get below err now,
BUILD FAILED
D:\apparat-ant-example\build\build.xml:64: Unable to execute command
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
ute.java:867)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.IllegalArgumentException
at java.lang.ProcessImpl.(ProcessImpl.java:69)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
ute.java:862)
… 21 more
Has anyone have come across this?
Joa, this is an ANT noob question…
How would one apply a Hidden Gems debug item like “apparat.7z.path” to the build.xml file in this example?
I’ve tried adding it to the tdsi tag in build.xml:
and tried adding it as an “” to the exec tag in build.xml.
I’ve also tried this in Flash Builder 4.5 – Run As > 2 Ant Build, Main tab, Arguments:
“-Dapparat.7z.path=/Users/tshayakhmetov/Applications/Keka.app/” with no success.
What am I doing wrong?
http://webdevotion.be/blog/2010/06/02/how-to-get-up-and-running-with-apparat/
this link requieres scala 2.8.0, if you getting java errors thats because of scala. GL
actually aptana using scala 2.8.0.RC7 anyone could share a download link?
Hey. If I didn’t use any apis of apparat, will tsid command will optimize the performance of my app?
6 Trackbacks
[...] This post was mentioned on Twitter by Joa Ebert, Little Buddha. Little Buddha said: RT @joa: New Apparat Example http://bit.ly/aVEBKi [...]
[...] FastMath Last week, I Looked into Joa Ebert’s blog post showcasing his new Apparat example. I downloaded the source he provided and set up Scala [...]
apparatの例はここにあります。http://blog.joa-ebert.com/2010/05/26/new-apparat-example/ #maxjp
[...] to the buildfile, buildr-as3 will download the Apparat framework, give your swf the extra speed via TurboDieselSportInjection and run the apparat reducer to compress your swf. First we need to make an instance of the [...]
[...] to the buildfile, buildr-as3 will download the Apparat framework, give your swf the extra speed via TurboDieselSportInjection and run the apparat reducer to compress your swf. First we need to make an instance of the [...]
[...] recently posted a simple example to illustrate the power of his powerfull optimization framework called Apparat. Apparat is a [...]