2 #include "canvas/group.h"
3 #include "canvas/canvas.h"
4 #include "canvas/root_group.h"
5 #include "canvas/rectangle.h"
9 using namespace ArdourCanvas;
12 test (int items_per_cell)
14 Group::default_items_per_cell = items_per_cell;
16 int const n_rectangles = 10000;
17 int const n_tests = 1000;
18 double const rough_size = 1000;
23 list<Item*> rectangles;
25 for (int i = 0; i < n_rectangles; ++i) {
26 rectangles.push_back (new Rectangle (canvas.root(), rect_random (rough_size)));
29 for (int i = 0; i < n_tests; ++i) {
30 Duple test (double_random() * rough_size, double_random() * rough_size);
32 /* ask the group what's at this point */
33 vector<Item const *> items;
34 canvas.root()->add_items_at_point (test, items);
40 int tests[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256 };
42 for (unsigned int i = 0; i < sizeof (tests) / sizeof (int); ++i) {
46 gettimeofday (&start, 0);
48 gettimeofday (&stop, 0);
50 int sec = stop.tv_sec - start.tv_sec;
51 int usec = stop.tv_usec - start.tv_usec;
57 double seconds = sec + ((double) usec / 1e6);
59 cout << "Test " << tests[i] << ": " << seconds << "\n";