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

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

Share Button

SWF rebuilding with as3swf code library

It’s been too long since we’ve had a good bandit raid topical content here. I’m going to fix it!)

Today we’ll speak about SWF changing using as3swf code library, as you could already guess from this post topic.
Continue reading

Share Button

Flash GAMM Moscow 2012

Hey guys!

I just posted my FlashGAMM Moscow 2012 report in the Russian blog section:

Since it’s a commonly Russian event, I did no English translation, you could look at my slides (they have English translation) about Flash Console, TheMiner, XFLTool and slide “engine” sources though.
You even can use Google Translate if you really wish to read my report)

Share Button

Going to FlashGAMM Moscow 2012

Hey, friends!
I’m preparing to the short trip to Moscow with very short blitz session on FlashGAMM.
I’ll speak about few advanced debugging and optimization tools.
I wrote few simple effects using Nape and Genome2D especially for my presentation, it was much more fun creating this effects then preparing the slides)
Blitz sessions section will start at 12:00 (Moscow time) in the “Saturn” hall.

If you will be at Moscow May 16-19 and wish to meet me – feel free to drop me few lines!

I’ll post my slides along with conference report here in the next few weeks, so you will be able to play with effects and see their sources!


Share Button