Speed Test – Tweening Engine Comparison Tool

Updated: 2011-06-18

On the heels of releasing a new version of TweenLite and TweenMax and investing a lot of time into optimizing performance, I figured I’d take a few minutes to throw together a tool that could demonstrate and quantify any speed differences among a few of the tweening engines out there. My goal was to post the tool and let the Flash community add to it if they so desired. It should be pretty simple actually. Download the source file here: AS2 or AS3. No trickery involved; the same code drives everything except for the tweens themselves. Basically it tweens white “stars” from the center outward at random angles, sizes, and with random delays. When a star’s tween ends, it just repositions itself at the center and starts again. You can play with the number of stars and the duration of the tweens to see how the tweening engines handle various types of loads.

Oh, and if you want to see the bezier tweening speed test, click here.

Select a tweening engine and click the “START” button.

And here’s a similar AS3 test. Keep in mind that AS3 runs in the MUCH faster AVM2, so I kicked up the instance numbers to keep it challenging.

You may be wondering what the “(FAST*)” means. I created a “fastTransform” plugin that takes advantage of strict data typing to speed things up slightly – it just demonstrates the concept of using a plugin to apply tweens in custom ways. And the TweenMax (FAST*) also uses a new feature that allows you to register certain easing classes (Strong, Quint, Quart, Cubic, Quad, and Linear) with the engine so that it uses special optimized code inside TweenMax that makes easing calculations about 40-80% faster.

The goal was not to figure out the most efficient way to tween a bunch of MovieClips in a starfield – it was to use a typical implementation for each engine that most people would use to do a single tween, and multiply that many times over to stress-test it. It’s meant to be a “real world” stress test. If the goal was simply to make the most efficient starfield, I could use a single tween instance that a looping function would check on every frame with a bunch of other code to do all the animation, but again, that doesn’t reflect “real world” typical usage. It would stress-test the code in your function, not the tweening engine. I provided the source code (AS2 or AS3) here so that everyone can see for themselves that I didn’t unfairly skew things in favor of any particular engine, but I’m certainly open to suggestions for optimization as long as it is in keeping with the goal of stress-testing the engines, not offloading the tweening calculations to another function.

Don’t be fooled

There have been a few speed tests on other sites that claim better speeds than TweenLite/Max and unfortunately they’re a bit misleading. In one, they have a stale version of TweenMax tweening Sprite objects which use 12.6 times more memory and require 2.2 times more processing power to update x and y properties compared to the Point objects that they tween using their engine! It’s no surprise that their test makes it look as though TweenMax is a memory hog and is half the speed of their engine. Another author has their engine push everything into a BitmapData object but they have TweenMax tweening raw overlapping objects, so the apparent speed difference is really the result of Flash not having to render the overlapping objects in the normal display list. When either engine was dropped into what I’d consider a more fair real-world test, TweenLite and TweenMax beat them both. I’d encourage everyone to do their own speed comparisons instead of assuming any authors’ tests are an accurate representation of real-world scenarios (including mine).

  • Twitter
  • Facebook
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • RSS
  • LinkedIn
  • Reddit

Comments (31) RSS

Posted by Zeh on October 21, 2007

Interesting comparison tool. I’ll cross-post what I’ve said on the Tweener mailing list, with some minor additions:

(…) It’s curious to see (from what my own benchmarks) that the impact on Tweener’s execution is more related to some very specific features – some options/features such as rounding values, some security checks as checking whether the object (still) exists or not during a tween, and specially, verifying whether a tweening already exists for a given object when a new tween is added – then the actual number of features. Verification of existing tweenings (that should then be overwritten) is what causes the biggest disparity in results I believe, so if you compare them with longer tweenings (ie, 10 seconds) then it’s a raw check of *updating* speed and the result (for all) is a lot closer.

But it shows that there’s some room for improvement for Tweener, I suppose.

While the current beta version has some fixes already (the one used on the test is the latest ‘stable’ one, before a few minor changes for speed) hopefully the current version I’m working on will be faster by breaking it in more classes, while also making some of those additional security/redundant checking optional since sometimes it might not be what people want.

Posted by Ryan Christensen [draw.logic] on October 21, 2007

Hey Jack nice test, it appears TweenLite scales pretty well. I wonder the performance of the AS3 kits comparisons as AS2 is really a dog compared to AS3 AVM2 virtual machine.

Posted by jack on October 22, 2007

Yep, the verification of existing tweens (and overwriting them) was a huge bottleneck in older versions of TweenLite too when doing tons of instantiations. The new version still has that feature fully intact (overwriting existing tweens of the same object) – I modified the lookup strategy so that it’s MUCH faster now, especially for MovieClips.

Zeh, Tweener has a huge following – you’ve done a great job building a full-featured tweening engine and it’s an honor to have you post here. I also admire your open and humble attitude about the various tweening engines available. If you’d like to drastically speed up Tweener’s verification routines, feel free to use my code (if it fits well in Tweener).

Posted by jack on October 22, 2007

Ryan, I just posted an AS3 version of the speed test too. You’re right – the AVM2 is MUCH speedier but you can still see some difference in the tweening engines when you crank up the number of instances and lower the duration.

Posted by Ryan Christensen [draw.logic] on October 22, 2007

Thanks for the update Jack, yes when AS3 comes in the threshold is much much higher and even a bit more level in terms of the animation kits. AS2 is such a dog I am not sure why it is hanging around being so slow :). Thanks for doing this it helps to speed things up when performance is highlighted and I think that we probably need a continual performance test of all anim kits much like bubblemark or comparisons of jquery, mootools, prototype etc.

Anything measured improves. Thanks for doing the AS3 version so quickly. It becomes another tool to show how much AS3 has surpassed AS2 in teh new AVM2 and how tight performance issues in AS2 become much higher thresholds in AS3. It still highlights a slow down in Tweener compared to TweenLite but there is some overhead in Tweener that is being worked on. I think this can only improve all animation kits when this is highlighted.

Posted by moses gunesch on October 22, 2007

Jack, great work and the stars must have been in alignment – this is super bizarre but I just posted a benchmarking utility myself, tonight as well! (Have been working on it for a week or so.) I hope it’s okay to post a link to it here, I certainly don’t mean to detract from your great work here at all… if it’s nothing but a big party then here’s mine:

TweenBencher: http://go.mosessupposes.com/?p=5

Yes AS3 just rips, it is incredible. I am able to run over 30,000 animations on a very normal computer system, whereas in AS2 about 400 and the player was toast.

I also wanted to say that I admire your work with TweenLite. My big thing is that we need to be looking at things from a marketplace perspective, and working to fill gaps and real needs. A low-filesize tween engine is by far one of the top requests I got for Fuse (I tried for a while early on but threw in the towel on that), and you’ve done a marvelous job with it. Kudos.

While I have the floor I also want to be sure you all hear my recent call for an Open Standard for AS3 animation systems. I am leading a community initiative to create such a standard now called Go, more info at my blog. In short the idea behind Go is that less is more, modular and flexible are good, while dumping too many top-to-bottom animation solutions into the marketplace may be leading us down a less good path. In regards to how much management slows engines down as in Zeh’s post above, Go answers this by making all mangement 100% opt-in use.

I would like to promote making animation scripting accessible for all AS3 developers, and think it would be neat if all of these systems can work together without too much redundancy.

Also just to clarify, having lots of tween engines out there is certainly not a bad thing at all – It is a great and healthy thing indeed, as there are lots of needs and niches to address. What can potentially be less than good is when each solution is built differently from the ground up with nothing in common and no easy way to synchronize them.

Thanks again for your great work Jack!

Posted by Andrew Fitzgerald on October 23, 2007

I suppose I should post too since my engine is the last one up there eh?

First I want to say I admire all of the various engine developers for their work and openness. Different developers that make high-quality tweening engines is a great thing. The inspiration from each other’s work actually helps make them a bit more unified and really lets the developers make each one as best as possible. Each one, like everything, has it’s strengths and weaknesses, but with ideas taken from each engine, essentially makes each stronger.

I’m sure each one of us wants ours (and each others) to be the best they can be, so benchmarks like these, I’d say, pushes us to make each of ours better, as Ryan mentioned. This ultimately creates a better experience for the developers who use them, and especially the end user. And isn’t that what it’s all about?

Posted by jack on October 23, 2007

Moses, wow, this is so weird having you, Zeh, and Andrew all post comments here. I’m very honored. Seriously, you’ve put a ton of work into Fuse and it’s quite obvious. On behalf of the Flash community, thanks. Same to you, Zeh and Andrew. I’m encouraged by the humble, open posture you all hold, and the desire to freely share your code which will in the end produce better solutions for everyone. As I’ve said before, feel free to use any of the strategies you find useful in TweenLite.

Posted by judy on November 10, 2007

Man, many times during the routine work day I end up dealing with these old guys who are paranoid and won’t let me even look at their code even though we both work for the same client and I have absolutely no interest in nicking it for my own use whatsoever, even if I did have a need for it…

Open source and open minds forever. Too bad most of the world doesn’t feel the same way.

Posted by Billy on December 6, 2007

Hey Jack, Nice work, actually I like all your guys work, I was wondering if you could at all update the AS3 bencher with some of the other engines out there. Maybe some from Tween Bencher. Both comparison tools are nice, and would like to see how your tool works with them to. Thanks!

Posted by jack on December 6, 2007

Thanks, Billy. Actually, I’d love to add more tweening engines to the AS3 comparison tool, but I’ve been slammed with work lately and just don’t have the time. I posted links to the source code, so you’re welcome to add them yourself. If you do, please send me your files so I can post them for everyone to benefit from. I hope to eventually whip together a bencher for filter tweens too, but again, I only have so much time in the day and I’ve gotta pay the bills :-)

Posted by bozboz web design brighton on January 13, 2008

This is really useful thanks, also shows how much better AS3 performs

Posted by zedia.net on January 21, 2008

I had some trouble at first with TweenLite, but I have been using it for a while and I can say that I love it. The speed and size is just amazing and this is exactly what I am looking for in a Tweening engine. GOASAP looks good and I will surely give it a try, but if you don’t want to build your animation package TweenLite is the way to go.

Great job!

Posted by Ryan on July 15, 2008

Wow, I had heard that TweenLite was faster than Tweener, but I would have never have guessed at twice the frame rate.

Posted by Tim Soret on September 2, 2008

We I heard about the gTween release, I was wondering if it was faster than TweenMax.

Then I saw that you have updated the speedtest. Now I don’t worry : I know that I chose the best tweening engine. Your work is still the most impressive so far. With new features like retargeting, now we can even use TweenMax for mouse based interactive animations.

I’m going to donate even more this week, because you deserve it so much. After one year of using TweenLite and now TweenMax, I can’t imagine how to develop and animate another way. TweenLite family is so essential to me, that I wonder if Adobe would grab your work one day, as they did with Robert Penner’s easing equations.

Thanks again, Jack.

Posted by Philip on February 3, 2009

This is sick! Totally converted from Tweener, can’t believe the performance difference. And the Plugin Explorer is seriously amazing, makes the whole product instantly accessible! Keep up the good work mate.

Posted by Matty B on March 26, 2009

I’m a long-time Tweener user but I’m now giving TweenLite/Max a go with my projects.

It seems promising, but I do have one question: do the speed tests use the same easing method across the different engines? If they don’t, this is obviously an inaccurate test because (for example) Tweener’s default easing is easeOutExpo, whereas TweenLite’s is easeOutRegular.

Posted by jack on March 26, 2009

Absolutely, Matty. The test uses exactly the same easing equation for all of the engines. In fact, the same code drives everything except the tweens themselves. You can verify all this by downloading the source (links are in the post). No tricks.

Posted by Matty B on March 26, 2009

Awesome — thanks for the info Jack!

I’m finding it pretty easy to make the switch as well. Kudos!

Posted by leef on October 22, 2009

What an exciting post to wake up to. I don’t recall how I arrived at TweenLite, but I’ve been with it for the longest time running now. All of the tween engine’s I’ve used have been godsends. Documentation is very important, and I really appreciate what you’ve put together Jack. I’m still hoping to see this tween plugin added. TweenLazy.to(me, yesterday, { projectCompletion:1.1, ease:Super.easeInOut, onComplete:wakeMeUp });

= >

Posted by Heath Hunnicutt on February 1, 2010

Hi Jack, this is a great comparison tool. I have found it really helpful in my work on a project related to AS3 performance. I was wondering if it would be convenient for you to add a “milliseconds to render frame” display? Regards!

Posted by Jeremy Daley on March 11, 2010

You need to put some kind of “ShareThis” widget on your posts or something. This is a nice comparison.

Posted by Francois on April 1, 2010

Thanks for benchmark!
There are some .fla in the source code so I suppose CS3 or CS4 is needed to modify the code, right?
I don’t have such tools (working on linux), so how can modify the test to include another tween library such as Desuade Motion Package?

Posted by Raz Peel on April 7, 2010

Great write-up.

It’s fantastic hearing what yourself and Zeh have to say on the comparisons. Keep up the good work!

Posted by Cardin on April 23, 2010

Your benchmark is proving to be very useful! I’d almost wanted to choose Adobe’s Tween class out of convenience, but wow. Instead of starburst I saw concentric circles like a bull’s eye. o.O
Kudos for this excellent piece of work.

Posted by don wan demarko on August 13, 2010

Have you been able to test the new Spark tween classes? I’m loving TweenLite but it’d be nice to know that Adobe’s tween class is not 1/15th the speed of what it could be…

Posted by Jack on August 14, 2010

Sure, don, I just added the Flex Spark stuff per your request, but it more than doubled the swf’s file size (added over 150k) and it’s still not even close to the speed of TweenLite/Max under pressure.

Posted by Jack on August 14, 2010

Francois, I just added Desuade’s DMP but there appears to be a garbage collection problem and I believe there’s also an issue with the way DMP handles timing internally because you’ll see the stars clump together into rings when the frame rate drops (I contacted the author about this a while back but I haven’t gotten a response yet). And yes, you need at least CS4 to open the FLA because the Flex Spark engine requires publishing to FP10 (sorry).

Posted by Abid Amin Khan on October 27, 2010

The TweenMax is really amazing as compared to Adobe’s Tween! Great Work!

Posted by Ravi on January 28, 2011

So, just to clarify selecting “Adobe Tween” in the pulldown box now means spark.effect.Animate or something like that and not fl.transitions.Tween etc?

Posted by Jack on January 28, 2011

No, Ravi, “Adobe Tween” means the Tween class from Adobe. TweenLite/Max are definitely faster than spark.effect.Animate too though. Feel free to run some tests yourself to verify.

To download the code, you must agree to the following license:

"NO CHARGE" NON-EXCLUSIVE SOFTWARE LICENSE AGREEMENT
-----------------------------------------------------------------------------
PLAIN ENGLISH SUMMARY:

  1. You may use the code at no charge in commercial or non-commercial apps, web sites, games, components, and other software as long as end users are not charged a fee of any kind to use your product or gain access to any part of it. If your client pays you a one-time fee to create the site/product, that's perfectly fine and qualifies under the "no charge" license. If end users are charged a usage/access/license fee, please sign up for a "Business Green" Club GreenSock membership which comes with a comprehensive commercial license. See http://www.greensock.com/club/ for details.
  2. Use at your own risk. No warranties are offered.
  3. Please respect the copyright.

-----------------------------------------------------------------------------

LEGALESE:

This is a legal agreement between you (either an individual or a single entity) and GreenSock, Inc. ("GREENSOCK") for the proprietary GreenSock code known as TweenLite, TweenMax, TweenNano, TimelineLite, TimelineMax, and other copyrighted code that is available for download at http://www.greensock.com (this code and documentation, as well as any updates which may at GREENSOCK's sole discretion be provided to you from time to time, are referred to in this Agreement as "PROGRAM"). By downloading, copying, or otherwise using the PROGRAM, you agree to the terms and conditions of this Agreement. If you do not agree to the terms and conditions of this Agreement, please do not download or use the PROGRAM.

I. LICENSE
A. Subject to the terms and conditions of this Agreement, GREENSOCK hereby grants you a non-exclusive, worldwide, non-transferable right to use the PROGRAM in apps, web sites, games, components and other software applications ("Developed Works") for which the end user is NOT charged any fees. If you would like to use the code in a commercially licensed Developed Work for which end users are charged a fee (either for usage or access), simply sign up for the appropriate "Business Green" Club GreenSock membership at http://www.greensock.com/club/.

II. LIMITATION OF LICENSE AND RESTRICTIONS
A. You agree that you will not sell, rent, or license the PROGRAM's source code or any derivative works thereof to any third party without the prior written consent of GREENSOCK. Distribution of the PROGRAM as part of your Developed Work is acceptable so long as it is used exclusively as a part of your Developed Work. You agree not to modify or delete GREENSOCK'S existing copyright notices located in the source code.

B. You may use, duplicate, and distribute the compiled object code as embedded in Developed Works created by you, either for your own use or for distribution to a third party so long as end users of the Developed Work are not charged a fee for usage of or access to any portion of the Developed Work. Please see http://www.greensock.com/licensing/ for descriptions of Developed Works that qualify for the "No Charge" license.

C. You may make modifications to the source code exclusively for your own use in order to perform bug fixes or other minor edits required to operate the PROGRAM as originally intended.

III. CONSIDERATION
A. The license rights granted to you under this Agreement are at no charge, but only in the following circumstances: If on your own behalf or on behalf of a third party you incorporate the PROGRAM into a web site, app, game, program or any component thereof (collectively, "Developed Work"), which in the case of a web site, must be accessible to internet users without payment of a fee of any kind, and in the case of a software application, game, program or component, neither you nor anyone to whom you distribute the Developed Work charges a user a fee of any kind to use such Developed Work or application, game, program or component into which such Developed Work is embedded. The foregoing shall apply regardless of whether you are paid to create such Developed Work.

B. In the event your intended use of the PROGRAM does not meet the criteria for the "no charge" license rights set forth in the immediately preceding paragraph, then you are not licensed to use the PROGRAM under this Agreement and must license the PROGRAM under GREENSOCK'S separate fee-based Software License Agreement which is granted to "Business Green" Club GreenSock members (see http://www.greensock.com/club/ for details).

C. You may make modifications to the source code exclusively for your own use in order to perform bug fixes or other minor edits required to operate the PROGRAM as originally intended.

IV. TITLE AND OWNERSHIP
A. The PROGRAM is licensed, not sold, and is protected by copyright laws and international treaty provisions. You acknowledge that no title to the intellectual property in the PROGRAM is transferred to you. You further acknowledge that title and full ownership rights to the PROGRAM, including all intellectual property rights therein, will remain the exclusive property of GREENSOCK and you will not acquire any rights to the PROGRAM except as expressly set forth in this Agreement. You agree that any copies of the PROGRAM you make will contain the same proprietary notices which appear on and in the PROGRAM. You agree that GREENSOCK may identify you as a licensee unless you make a written request otherwise. GREENSOCK hereby grants to you the right to disclose that your product, game, software application, component, or other Developed Work makes use of GREENSOCK code (for example, "Powered by TweenLite").

V. DISCLAIMER OF WARRANTY AND LIMITATION OF LIABILITY
A. THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. GREENSOCK DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE PROGRAM WILL MEET YOUR REQUIREMENTS OR THAT OPERATION WILL BE UNINTERRUPTED OR ERROR FREE. GREENSOCK shall not be liable for special, indirect, incidental, or consequential damages with respect to any claim on account of or arising from this Agreement or use of the PROGRAM, even if GREENSOCK has been or is hereafter advised of the possibility of such damages. Because some states do not allow certain exclusions or limitations on implied warranties or of liability for consequential or incidental damages, the above exclusions may not apply to you. In no event, however, will GREENSOCK be liable to you, under any theory of recovery, in an amount in excess of $250. Notwithstanding anything else in this agreement, you agree to indemnify GREENSOCK, its assignees, and licensees, and hold each of them harmless from and against any and all claims, losses, damages, and expenses, including legal fees arising out of or resulting from any negligent act or omission by you.

B. GREENSOCK may, at its sole discretion, provide support services related to the PROGRAM, but has no obligation to do so.

VI. TERMINATION
If you at any time fail to abide by the terms of this Agreement, GREENSOCK shall have the right to immediately terminate the license granted herein and pursue any other legal or equitable remedies available.

VII. MISCELLANEOUS
A. This Agreement shall be construed in accordance with the laws of the State of Illinois. In the event of any dispute between you and GREENSOCK with respect to this Agreement, we both agree that if we cannot resolve the dispute in good faith discussion, either of us may submit the dispute for resolution to arbitration with the American Arbitration Association before a single arbitrator using the AAA Rules for Commercial Arbitration. The arbitrator's decision is final and can be enforced in any court with jurisdiction over such matters.

B. This agreement represents the complete and exclusive statement of the agreement between GREENSOCK and you and supersedes all prior agreements, proposals, representations and other communications, verbal or written, between them with respect to use of the program. This agreement may be modified only with the mutual written approval of authorized representatives of the parties.

C. The terms and conditions of this Agreement shall prevail notwithstanding any different, conflicting, or additional terms or conditions which may appear in any purchase order or other document submitted by you. You agree that such additional or inconsistent terms are deemed rejected by GREENSOCK.

D. GREENSOCK and you agree that any xerographically or electronically reproduced copy of this Agreement shall have the same legal force and effect as any copy bearing original signatures of the parties.

Copyright 2006-2013, GreenSock, Inc. Updated 2012-08-28

I'd like to learn how to get bonus plugins, update notifications, SVN access, and more.
To continue, you must agree to the following license: