Posts Tagged read

File I/O Performance Tips

Tags: , , , , , ,

At some point, every project ends up reading or writing to the file system. If you do anything more than storing a single blob of bytes (e.g. JSON text) then you’ll need to be very careful about performance. It’s easy to accidentally write code that takes way longer to read and write than it should and you won’t get any help from the compiler or from Unity. Today’s article reveals some of these traps so you won’t fall into them!

Read the rest of this article »

13 Comments

Int Keys: Object vs. Dictionary vs. Array vs. Vector

Tags: , , , , , , , ,

Given that Object and Dictionary can have int keys and that int keys are faster than String keys, a natural performance test follows: which class is fastest at reading from and writing to those int keys? Is there a difference between the four Vector classes? Today’s article performs just that test and comes up with the answers.

Read the rest of this article »

8 Comments

Maps With Int Keys: Array vs. Dictionary

Tags: , , , , , ,

Behind the scenes Array holds its values in two ways: a densely-packed array at the beginning and a sparsely-packed map after that. This means it can be used as a map where the keys are indexes and not take up a huge amount of wasted space. Dictionary can also have int keys. Which is faster? Today we’ll find out!

Read the rest of this article »

7 Comments

Static vs. Non-Static

Tags: , , , , , ,

Tip #8 in my Top 10 Performance Tips For 2012 was to reduce static accesses of variables, functions, etc. in favor of non-static variables and, especially, local variables. I neglected to reference one of my articles and it was pointed out to me that I hadn’t actually written such an article! So today I’ll elaborate on my tip and show why you should prefer non-static and local variables so you can find out just why it deserves its place as a top tip.

Read the rest of this article »

19 Comments

Dynamic Field Access

Tags: , , , , , , , , ,

AS3 has an interesting feature that is sometimes used to great effect: dynamic classes. These classes can have fields added and removed to them and used like any other field. You can even make your own dynamic classes with the dynamic keyword. However, all of this fancy functionality comes at a steep performance cost. How steep? Read on to see just how steep.

Read the rest of this article »

10 Comments

Array vs. Vector Part II

Tags: , , , , , ,

Today’s article is in response to some interesting comments on the previous article comparing Array‘s performance to that of Vector. Today I’ll test different types of Vectors and the performance of deleting elements.

Read the rest of this article »

15 Comments