summaryrefslogtreecommitdiffstats
path: root/libdimension/bench
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-06-07 16:58:20 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-06-07 16:58:20 -0400
commita22560c3ccaf19261b5c40fdcab36d2d22426986 (patch)
tree85a39e016ac972f54e282eedcf32b26da6f67822 /libdimension/bench
parentbfadc2ee359f10842da21336795e54f24a2746e3 (diff)
downloaddimension-a22560c3ccaf19261b5c40fdcab36d2d22426986.tar.xz
Use // comments when possible.
Diffstat (limited to 'libdimension/bench')
-rw-r--r--libdimension/bench/array.c22
-rw-r--r--libdimension/bench/future.c4
-rw-r--r--libdimension/bench/geometry.c46
-rw-r--r--libdimension/bench/polynomial.c10
-rw-r--r--libdimension/bench/prtree.c6
-rw-r--r--libdimension/bench/triangle.c4
6 files changed, 46 insertions, 46 deletions
diff --git a/libdimension/bench/array.c b/libdimension/bench/array.c
index 3fe0c83..b48a03f 100644
--- a/libdimension/bench/array.c
+++ b/libdimension/bench/array.c
@@ -34,7 +34,7 @@ main(void)
return EXIT_FAILURE;
}
- /* Benchmark allocation and deallocation */
+ // Benchmark allocation and deallocation
dmnsn_array *array;
sandglass_bench_fine(&sandglass, {
array = dmnsn_new_array(sizeof(object));
@@ -42,10 +42,10 @@ main(void)
});
printf("dmnsn_new_array() + dmnsn_delete_array(): %ld\n", sandglass.grains);
- /* Create our test array */
+ // Create our test array
array = dmnsn_new_array(sizeof(object));
- /* dmnsn_array_push() */
+ // dmnsn_array_push()
printf("dmnsn_array_push():");
@@ -55,25 +55,25 @@ main(void)
}
printf("\n");
- /* dmnsn_array_get() */
+ // dmnsn_array_get()
sandglass_bench_fine(&sandglass, dmnsn_array_get(array, count/2, &object));
printf("dmnsn_array_get(): %ld\n", sandglass.grains);
- /* dmnsn_array_set() */
+ // dmnsn_array_set()
sandglass_bench_fine(&sandglass, dmnsn_array_set(array, count/2, &object));
printf("dmnsn_array_set(): %ld\n", sandglass.grains);
- /* dmnsn_array_at() */
+ // dmnsn_array_at()
void *ptr;
sandglass_bench_fine(&sandglass, ptr = dmnsn_array_at(array, count/2));
printf("dmnsn_array_at() = %p: %ld\n", ptr, sandglass.grains);
- /* dmnsn_array_size() */
+ // dmnsn_array_size()
size_t size;
sandglass_bench_fine(&sandglass, size = dmnsn_array_size(array));
printf("dmnsn_array_size() = %zu: %ld\n", size, sandglass.grains);
- /* dmnsn_array_resize() */
+ // dmnsn_array_resize()
dmnsn_array_resize(array, count);
sandglass_bench_noprecache(&sandglass, dmnsn_array_resize(array, count * 2));
printf("dmnsn_array_resize(): %ld", sandglass.grains);
@@ -81,7 +81,7 @@ main(void)
sandglass_bench_noprecache(&sandglass, dmnsn_array_resize(array, count));
printf(" %ld\n", sandglass.grains);
- /* dmnsn_array_insert() */
+ // dmnsn_array_insert()
printf("dmnsn_array_insert():");
@@ -92,7 +92,7 @@ main(void)
}
printf("\n");
- /* dmnsn_array_remove() */
+ // dmnsn_array_remove()
printf("dmnsn_array_remove():");
@@ -103,7 +103,7 @@ main(void)
}
printf("\n");
- /* dmnsn_array_pop() */
+ // dmnsn_array_pop()
printf("dmnsn_array_pop():");
diff --git a/libdimension/bench/future.c b/libdimension/bench/future.c
index f42430e..fd26363 100644
--- a/libdimension/bench/future.c
+++ b/libdimension/bench/future.c
@@ -37,7 +37,7 @@ dmnsn_bench_future_increment(void)
exit(EXIT_FAILURE);
}
- /* Benchmark the increment operation. */
+ // Benchmark the increment operation.
sandglass_bench_fine(&sandglass, dmnsn_future_increment(future));
printf("dmnsn_future_increment(): %ld\n", sandglass.grains);
@@ -62,7 +62,7 @@ dmnsn_bench_future_thread(void *ptr)
size_t nthreads = 2*dmnsn_ncpus();
dmnsn_future_set_total(future, nthreads*ITERATIONS);
- /* Now run a bunch of increments concurrently. */
+ // Now run a bunch of increments concurrently.
return dmnsn_execute_concurrently(future, dmnsn_bench_future_ccthread,
future, nthreads);
}
diff --git a/libdimension/bench/geometry.c b/libdimension/bench/geometry.c
index 4b8c12a..56c8b58 100644
--- a/libdimension/bench/geometry.c
+++ b/libdimension/bench/geometry.c
@@ -35,13 +35,13 @@ main(void)
return EXIT_FAILURE;
}
- /* dmnsn_new_vector() */
+ // dmnsn_new_vector()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_new_vector(1.0, 2.0, 3.0);
});
printf("dmnsn_new_vector(): %ld\n", sandglass.grains);
- /* dmnsn_matrix_construct() */
+ // dmnsn_matrix_construct()
sandglass_bench_fine(&sandglass, {
matrix = dmnsn_new_matrix(1.0, 1.0, 0.0, 0.0,
1.0, 1.0, 1.0, 0.0,
@@ -49,92 +49,92 @@ main(void)
});
printf("dmnsn_new_matrix(): %ld\n", sandglass.grains);
- /* dmnsn_identity_matrix() */
+ // dmnsn_identity_matrix()
sandglass_bench_fine(&sandglass, {
matrix = dmnsn_identity_matrix();
});
printf("dmnsn_identity_matrix(): %ld\n", sandglass.grains);
- /* dmnsn_scale_matrix() */
+ // dmnsn_scale_matrix()
sandglass_bench_fine(&sandglass, {
matrix = dmnsn_scale_matrix(vector);
});
printf("dmnsn_scale_matrix(): %ld\n", sandglass.grains);
- /* dmnsn_identity_matrix() */
+ // dmnsn_identity_matrix()
sandglass_bench_fine(&sandglass, {
matrix = dmnsn_translation_matrix(vector);
});
printf("dmnsn_translation_matrix(): %ld\n", sandglass.grains);
- /* dmnsn_rotation_matrix() */
+ // dmnsn_rotation_matrix()
sandglass_bench_fine(&sandglass, {
matrix = dmnsn_rotation_matrix(vector);
});
printf("dmnsn_rotation_matrix(): %ld\n", sandglass.grains);
- /* dmnsn_new_line() */
+ // dmnsn_new_line()
vector2 = dmnsn_new_vector(3.0, 2.0, 1.0);
sandglass_bench_fine(&sandglass, {
line = dmnsn_new_line(vector, vector2);
});
printf("dmnsn_new_line(): %ld\n", sandglass.grains);
- /* dmnsn_vector_add() */
+ // dmnsn_vector_add()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_vector_add(vector, vector2);
});
printf("dmnsn_vector_add(): %ld\n", sandglass.grains);
- /* dmnsn_vector_sub() */
+ // dmnsn_vector_sub()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_vector_sub(vector, vector2);
});
printf("dmnsn_vector_sub(): %ld\n", sandglass.grains);
- /* dmnsn_vector_mul() */
+ // dmnsn_vector_mul()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_vector_mul(2.0, vector);
});
printf("dmnsn_vector_mul(): %ld\n", sandglass.grains);
- /* dmnsn_vector_div() */
+ // dmnsn_vector_div()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_vector_div(vector, 2.0);
});
printf("dmnsn_vector_div(): %ld\n", sandglass.grains);
- /* dmnsn_vector_cross() */
+ // dmnsn_vector_cross()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_vector_cross(vector, vector2);
});
printf("dmnsn_vector_cross(): %ld\n", sandglass.grains);
- /* dmnsn_vector_dot() */
+ // dmnsn_vector_dot()
sandglass_bench_fine(&sandglass, {
result = dmnsn_vector_dot(vector, vector2);
});
printf("dmnsn_vector_dot(): %ld\n", sandglass.grains);
- /* dmnsn_vector_norm() */
+ // dmnsn_vector_norm()
sandglass_bench_fine(&sandglass, {
result = dmnsn_vector_norm(vector);
});
printf("dmnsn_vector_norm(): %ld\n", sandglass.grains);
- /* dmnsn_vector_normalized() */
+ // dmnsn_vector_normalized()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_vector_normalized(vector);
});
printf("dmnsn_vector_normalized(): %ld\n", sandglass.grains);
- /* dmnsn_matrix_inverse() */
+ // dmnsn_matrix_inverse()
sandglass_bench_fine(&sandglass, {
matrix = dmnsn_matrix_inverse(matrix);
});
printf("dmnsn_matrix_inverse(): %ld\n", sandglass.grains);
- /* dmnsn_matrix_inverse(HARD) */
+ // dmnsn_matrix_inverse(HARD)
matrix2 = dmnsn_new_matrix(1.0, 1.0, 0.0, 0.0,
1.0, 1.0, 1.0, 0.0,
0.0, 1.0, 1.0, 0.0);
@@ -143,37 +143,37 @@ main(void)
});
printf("dmnsn_matrix_inverse(HARD): %ld\n", sandglass.grains);
- /* dmnsn_matrix_mul() */
+ // dmnsn_matrix_mul()
sandglass_bench_fine(&sandglass, {
matrix = dmnsn_matrix_mul(matrix, matrix2);
});
printf("dmnsn_matrix_mul(): %ld\n", sandglass.grains);
- /* dmnsn_transform_point() */
+ // dmnsn_transform_point()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_transform_point(matrix, vector);
});
printf("dmnsn_transform_point(): %ld\n", sandglass.grains);
- /* dmnsn_transform_direction() */
+ // dmnsn_transform_direction()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_transform_direction(matrix, vector);
});
printf("dmnsn_transform_direction(): %ld\n", sandglass.grains);
- /* dmnsn_transform_normal() */
+ // dmnsn_transform_normal()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_transform_normal(matrix, vector);
});
printf("dmnsn_transform_normal(): %ld\n", sandglass.grains);
- /* dmnsn_transform_line() */
+ // dmnsn_transform_line()
sandglass_bench_fine(&sandglass, {
line = dmnsn_transform_line(matrix, line);
});
printf("dmnsn_transform_line(): %ld\n", sandglass.grains);
- /* dmnsn_line_point() */
+ // dmnsn_line_point()
sandglass_bench_fine(&sandglass, {
vector = dmnsn_line_point(line, result);
});
diff --git a/libdimension/bench/polynomial.c b/libdimension/bench/polynomial.c
index b66648c..bf3d2b0 100644
--- a/libdimension/bench/polynomial.c
+++ b/libdimension/bench/polynomial.c
@@ -27,29 +27,29 @@ main(void)
#define NPOLY 5
double p[NPOLY][NPOLY + 1], x[NPOLY];
- /* p[0][] = x - 0.5; */
+ // p[0][] = x - 0.5;
p[0][1] = 1.0;
p[0][0] = -0.5;
- /* p[1][] = (x + 0.5)*(x - 0.5) */
+ // p[1][] = (x + 0.5)*(x - 0.5)
p[1][2] = 1.0;
p[1][1] = 0.0;
p[1][0] = -0.25;
- /* p[2][] = (x + 1)*(x - 1.2345)*(x - 100) */
+ // p[2][] = (x + 1)*(x - 1.2345)*(x - 100)
p[2][3] = 1.0;
p[2][2] = -100.2345;
p[2][1] = 22.2155;
p[2][0] = 123.45;
- /* p[3][] = (x + 1)*(x - 1.2345)*(x - 5)*(x - 100) */
+ // p[3][] = (x + 1)*(x - 1.2345)*(x - 5)*(x - 100)
p[3][4] = 1.0;
p[3][3] = -105.2345;
p[3][2] = 523.388;
p[3][1] = 12.3725;
p[3][0] = -617.25;
- /* p[4][] = (x + 1)*(x - 1.2345)*(x - 2.3456)*(x - 5)*(x - 100) */
+ // p[4][] = (x + 1)*(x - 1.2345)*(x - 2.3456)*(x - 5)*(x - 100)
p[4][5] = 1.0;
p[4][4] = -107.5801;
p[4][3] = 770.2260432;
diff --git a/libdimension/bench/prtree.c b/libdimension/bench/prtree.c
index dc5a90d..6c5d3ef 100644
--- a/libdimension/bench/prtree.c
+++ b/libdimension/bench/prtree.c
@@ -98,7 +98,7 @@ main(void)
});
printf("dmnsn_new_bvh(DMNSN_BVH_PRTREE): %ld\n", sandglass.grains);
- /* dmnsn_bvh_intersection() */
+ // dmnsn_bvh_intersection()
dmnsn_line ray = dmnsn_new_line(
dmnsn_new_vector( 1.0, 1.0, -2.0),
dmnsn_new_vector(-0.5, -0.5, 1.0)
@@ -115,13 +115,13 @@ main(void)
});
printf("dmnsn_bvh_intersection(nocache): %ld\n", sandglass.grains);
- /* dmnsn_bvh_inside() */
+ // dmnsn_bvh_inside()
sandglass_bench_fine(&sandglass, {
dmnsn_bvh_inside(bvh, dmnsn_zero);
});
printf("dmnsn_bvh_inside(): %ld\n", sandglass.grains);
- /* Cleanup */
+ // Cleanup
dmnsn_delete_bvh(bvh);
dmnsn_delete_pool(pool);
return EXIT_SUCCESS;
diff --git a/libdimension/bench/triangle.c b/libdimension/bench/triangle.c
index 05b8f47..b2b91d0 100644
--- a/libdimension/bench/triangle.c
+++ b/libdimension/bench/triangle.c
@@ -46,7 +46,7 @@ main(void)
dmnsn_line line;
bool intersected;
- /* Intersecting case */
+ // Intersecting case
line = dmnsn_new_line(dmnsn_new_vector(2.0, 1.0, -1.0), dmnsn_z);
sandglass_bench_fine(&sandglass, {
intersected = dmnsn_object_intersection(triangle, line, &intersection);
@@ -54,7 +54,7 @@ main(void)
dmnsn_assert(intersected, "Didn't intersect");
printf("dmnsn_triangle_intersection(true): %ld\n", sandglass.grains);
- /* Non-intersecting case */
+ // Non-intersecting case
line = dmnsn_new_line(dmnsn_new_vector(3.0, 3.0, -1.0), dmnsn_z);
sandglass_bench_fine(&sandglass, {
intersected = dmnsn_object_intersection(triangle, line, &intersection);