Files
gitx/speed_test/array.m
T
Pieter de Bie 061eb7de48 Grapher: add speed tests
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.
2008-06-21 13:41:55 +02:00

33 lines
722 B
Objective-C

#include <stdlib.h>
#include <stdio.h>
#include <xlocale.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <Cocoa/Cocoa.h>
int main() {
srandomdev();
int i = 0; struct list* last;
int num = atoi("8000000");
int size = 1000;
int totColumns = 10000;
int currentColumn = 0;
NSMutableArray* array = [NSMutableArray arrayWithCapacity: 100*size];
for (i = 0; i < num; i++) {
int numColumns = i % 5;
NSMutableArray* arr = [NSMutableArray arrayWithCapacity: numColumns];
int j;
for (j = 0; j < numColumns; j++)
[arr addObject: @"Ha"];
[array addObject: arr];
}
[array release];
return 0;
}