Monday, September 21, 2009

Last week

I was doing stress testing of the Asset Manager.

I created a project with 65,536 animations 100K each. Comparing with the real projects: FIFA in EA has about 30,000 animations. Standard animation size is about 20K-30K.

I was trying to compare the performance with ANT. ANT is a similar tool that EA is using for sports games. Unfortunately I don't have an access to ANT right now. So I couldn't compare them correctly. I just tried to compare my memories with what I'm having.

The results were quite good.
1. Saving/loading single asset time is not noticeable. I don't even set the mouse cursor to hour glass.
2. Loading the project time is not noticeable either.
3. Saving all takes 17 minutes.
4. Compiling all assets takes 21 minute. Compiling is creating runtime files. I didn't implement multithreaded version of compiling yet. But the assets were implemented keeping multithreading in mind. I'm hoping to reduce this time to 7-8 minutes by using 4 threads. It's planned for this week. So I'll see it very soon.

From what I remember this is much better than ANT numbers. Single asset loading took some noticeable time. Sometimes it even popped up a dialog with a progress bar. Full compiling of FIFA project took about half an hour. Again as I said - I don't remember the exact numbers.

The main secret is - I'm not using XML serialization. There were some plans to change the serialization in ANT. May be they've done it. I don't know.

Basically I'm a huge opponent of XML. I think using XML is the best method to make your application slow and memory consuming. Every time I read about advantages of XML, I find nothing reasonable. The standard argument is "it's human readable". Nice. Look at this simple document (a random file taken from the windows system directory):

<xml version="1.0">
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
<major>1<major>
<minor>0<minor>
<actionlist>
<action>
<name>magiconname</name>
</action>
</actionlist>

Is "scpd xmlns" human readable? Hmm...

Doesn't matter. A better question is: how our application benefits from the human readable format? Please don't substitute the question. I'm not asking you how the programmers benefit from human readable format. After all what is our goal: a good application or a happy development team? Well some people choose a happy development team. Considering they are a part of this team, I can't blame them for it.

But here is what application gets:
This text size is 219 bytes long. Considering unicode it's even bigger. Now look at the data. A binary writer can put all the significant data of this file into 4 bytes. XML is 55 times bigger. Which means it takes 55 times more memory, and loading is 55 times slower. If this is not a waste of memory, file space, or network traffic - you should tell me what is a waste.

No comments:

Post a Comment