speed_test
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
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