mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 15:30:18 +00:00
061eb7de48
This creates a new directory speed_test with different implementations that we can use to power the grapher. The current implementation is somewhat lacking in that we build up the graph completely at the end. If we can do it while traversing the tree, we can build and display it earlier. Similarly, if we can leave out the line calculation but just work with the columns, we save computation at load time, and can defer the lines to the drawing process. That will also clear up the problem of not being able to draw some lines.
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