forked from laullon/gitx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
26 lines (21 loc) · 1 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
These tests demonstrate 3 different ways to allocate memory for the graph
viewer.
The methods:
1. global
This method allocates a global memory pool that is used by all structs.
It is the fastest method and should be easy to clean up. You do have to
make sure that any pointers to the memory used by others is cleaned up.
1. malloc
This methods does two mallocs for every iteration. It is slightly slower
(2x as slow), but won't require as much unfragmented memory. It is harder
to clean up this memory, as it requires an equal amount of free's.
2. array
This method uses NSMutableArray's to store the necessary information. It is
by far the slowest (10x slower than global) but will make use of
Objective-C's garbage collection. This is the easiest way to go if it isn't
too slow. Looping and creating the arrays takes about 2 seconds for 800k
iterations. The question is if this significantly slows down the work.
Results:
global: 0.18 seconds
malloc: 0.39 seconds
array: 1.90 seconds