Unity3D Tweening performance

Hey, I’ll be short =)
I’m going to compare quickly 3 types of tween animations: built-in Legacy Animation, HOTween and DOTween.
I use 5k objects from prefabs as tweens targets.
Tweens are looped, start by default, have 1 sec length and tweening transform position from (0, 0, 0) to (1.3, 1.4, 1.5).

Used software info:
– Unity 4.6 Beta 16.
– HOTween v1.3.350.
– DOTween 0.7.310 Alpha
– Unity profiler with ‘Deep Profile’ enabled.

Initialization resources usage

Let’s compare initialization time and GC allocations first.
Time + GC Allocation + real memory allocation. Time is frame total time. Memory usage includes memory used by objects.

Frame time: ~166.7 ms (from 3 samples)
GC Allocations: 97.8 KB
Total memory usage: ~20.07 MB (from 3 samples)
Frames to initialize: 1

Frame time: ~268.68 ms (from 3 samples) + ~55.62 ms (from 3 samples) for second frame
GC Allocations: 4293 KB + 1.3 KB for second frame
Total memory usage: ~25.1 MB (from 3 samples)
Frames to initialize: 2

Frame time: 122.86 ms (from 3 samples)
GC Allocations: 1800 KB (may be kept away from GC using internal pooling)
Total memory usage: ~10 MB (from 3 samples)
Frames to initialize: 1

Resources usage per frame

Now tweening performance, allocations per frame (excluding constant Unity-releated allocators) and total memory usage while running tweens (memory usage increases for a while after initialization).
Time is frame total time.

Frame time: 12-13 ms
GC Allocations: 0 B

Frame time: 36-40 ms
GC Allocations: 420 B – 672 B (sad face here)

Frame time: 9 ms
GC Allocations: 0 B

Resulting charts

CPU time, ms (lower is better)

Memory usage on initialization, MB (lower is better)

Brand new DOTween gets the best Unity tweening solution award from me!
And it’s free, very flexible, user-friendly and has a great author. It definitely desires donation!

Grab messy benchmark sources (should be compatible with Unity 4.5) here.

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button

Unity3D threads – measuring performance

Hey everybody!
Sometimes people ask me about delayed actions or threading in Unity3D and usually I suggest to use coroutines since they are suitable for the most cases I faced with.
But sometimes we need to use true threading and make some calculations faster, A* path finding for example.
So I decided to make a fast-written performance comparison of traditional code execution vs. threaded version. I searched for some simple threads managers and found this really simple Loom class from whydoidoit accidentally.

I did a simple test app for different platforms (I attached archive with apps and sources at the end of this post) and found some results pretty interesting.
All my code is trying to do – is just to make CPU think a little while working with huge array of Vector3D instances (10 000 000 for Desktop platforms and 1 000 000 for mobile platforms):

private void Run()
	const float scale = 432.654f;

	for (int j = 0; j < arrayLength; j++)
		Vector3 v = vertices[j];

		v = Vector3.Lerp(v * scale / 123f * v.magnitude, v / scale * 0.0123f * v.magnitude, v.magnitude);

		vertices[j] = v;

This is a simple dummy code as you can see.
I added simple Ant model (hello, Away3D examples authors! :)) with rotation at Update() to the scene in order to see how app can freeze while running this ugly code in main thread.


I did few tests of this code as I mentioned previously, both in sync (straight execution in main thread) and async (running it the separate threads) modes, here are results I’ve got (S – sync, A – async):
Continue reading

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button

AIR vs. Unity3D. Who’s faster? (Update 1)

Update 1: uploaded some sources (look at the end of article).

Hey there!
Yeah, it’s been a while blahblahblah.. To the point! =)

Sometimes I’ll highlight actual files from the archive, attached at the page bottom.

Sometimes I see Flash developers interested in the Unity3D lately, and I – one of them actually)
I work with Unity for a while already and all I can say – it’s fantastic experience! So cool to learn C# language (I hope other Flash devs make wise decision to code in C# as well), to learn new community and people, to meet a lot of new challenges and to look at 3D world from a new point at all!

Many Flash developers are still uncertain they should try Unity and spend their time learning this brand new world though.. And in some cases it’s built on top of the AIR and Unity3D performance differences obscurity. So I’ll unveil portion of this differences in this article to help those Flash developers make a choice (whatever what they choose)!

All examples I’ll compile with AIR 3.6 and Unity3D 4.1 and I’ll try to keep similar functionality and look of these examples to let them compete.
I’ll test builds on the pretty slow Samsung Galaxy Tab 10.1 and make some tests on the desktop as well.


Okay, let’s start from comparing empty builds.
To measure FPS in unity3D I’ll use hand-made FPSmeter working with GUIText.
In AIR builds I’ll use different FPSmeters, usually in-built to the frameworks I’ll use.
Well, let’s see to the built apks (I built Captive Runtime in AIR and usual release build in Unity3D):
Continue reading

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button

Efficient Adobe Flash Professional using

Working with Adobe Flash Professional you should consider about performance and culture of the content you’re creating.
After some docs reading and co-workers listening, I came to this: I should collect and keep most common and useful “authoring-in-Flash Pro” rules in one place to help with efficient content creating. To make your knowledge of this topic even deeper – consider reading completely all links at the end of this post.
These rules will be useful for the Flash Animators and Flash Designers first of all, developers should know some rules too though.

Completely compatible with Flash Pro CS5.5 and not completely with earlier versions.

Continue reading

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button