summaryrefslogtreecommitdiffstats
path: root/bench
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-05-15 15:54:56 -0600
committerTavian Barnes <tavianator@gmail.com>2011-05-15 15:58:05 -0600
commita5a6b94c038e01ebf1e2de0a0774a69b02fb8e1e (patch)
tree66a4b977fff9f0119456b6c5a3398d25976f6c53 /bench
parent130cbc32499ade9235873bc5d575816f80636916 (diff)
downloaddimension-a5a6b94c038e01ebf1e2de0a0774a69b02fb8e1e.tar.xz
Group tests and benchmarks with the corresponding source code.
Diffstat (limited to 'bench')
-rw-r--r--bench/Makefile.am26
-rw-r--r--bench/dimension/Makefile.am35
-rw-r--r--bench/dimension/bench.pov118
-rwxr-xr-xbench/dimension/parse.sh59
-rwxr-xr-xbench/dimension/render.sh25
-rwxr-xr-xbench/dimension/tokenize.sh24
-rw-r--r--bench/libdimension/Makefile.am41
-rw-r--r--bench/libdimension/array.c118
-rw-r--r--bench/libdimension/geometry.c171
-rw-r--r--bench/libdimension/polynomial.c72
-rw-r--r--bench/libdimension/prtree.c119
11 files changed, 0 insertions, 808 deletions
diff --git a/bench/Makefile.am b/bench/Makefile.am
deleted file mode 100644
index 8404c22..0000000
--- a/bench/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-###########################################################################
-## Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> ##
-## ##
-## This file is part of The Dimension Build Suite. ##
-## ##
-## The Dimension Build Suite is free software; you can redistribute it ##
-## and/or modify it under the terms of the GNU General Public License as ##
-## published by the Free Software Foundation; either version 3 of the ##
-## License, or (at your option) any later version. ##
-## ##
-## The Dimension Build Suite is distributed in the hope that it will be ##
-## useful, but WITHOUT ANY WARRANTY; without even the implied warranty ##
-## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
-## General Public License for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program. If not, see <http://www.gnu.org/licenses/>. ##
-###########################################################################
-
-SUBDIRS = libdimension dimension
-
-bench: all-recursive
- cd libdimension && $(MAKE) $(AM_MAKEFLAGS) bench
- cd dimension && $(MAKE) $(AM_MAKEFLAGS) bench
-
-.PHONY: bench
diff --git a/bench/dimension/Makefile.am b/bench/dimension/Makefile.am
deleted file mode 100644
index e7fe03f..0000000
--- a/bench/dimension/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-###########################################################################
-## Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> ##
-## ##
-## This file is part of The Dimension Build Suite. ##
-## ##
-## The Dimension Build Suite is free software; you can redistribute it ##
-## and/or modify it under the terms of the GNU General Public License as ##
-## published by the Free Software Foundation; either version 3 of the ##
-## License, or (at your option) any later version. ##
-## ##
-## The Dimension Build Suite is distributed in the hope that it will be ##
-## useful, but WITHOUT ANY WARRANTY; without even the implied warranty ##
-## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
-## General Public License for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program. If not, see <http://www.gnu.org/licenses/>. ##
-###########################################################################
-
-ENVIRONMENT = top_builddir=$(top_builddir)
-
-bench: tokenize.sh parse.sh render.sh
- $(ENVIRONMENT) ./tokenize.sh
- $(ENVIRONMENT) ./parse.sh
- $(ENVIRONMENT) ./render.sh
-
-.sh:
- cp $(srcdir)/$@ .
-
-clean-local:
- rm -f *.png
-
-EXTRA_DIST = bench.pov
-
-.PHONY: bench
diff --git a/bench/dimension/bench.pov b/bench/dimension/bench.pov
deleted file mode 100644
index a4f632f..0000000
--- a/bench/dimension/bench.pov
+++ /dev/null
@@ -1,118 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> *
- * *
- * This file is part of The Dimension Benchmark Suite. *
- * *
- * The Dimension Benchmark Suite is free software; you can redistribute *
- * it and/or modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Benchmark Suite is distributed in the hope that it will *
- * be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
- * the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-camera {
- location <3.0, 6.0, -11.0>
- right x*image_width/image_height
- look_at 0
-}
-
-background {
- color rgb 1
-}
-
-// inside center sphere
-light_source {
- 0,
- color rgb 1
-}
-
-light_source {
- 2*y,
- color rgb 1
-}
-
-/* plane {
- y,
- -1
- // *** hollow on
- pigment {
- rgb <0.73, 0.90, 0.97>
- }
- finish {
- diffuse 0.35
- ambient .5
- }
-} */
-
-#macro sph(center)
- sphere {
- center,
- 1
- texture {
- // *** crackle
- scale 0.5
-
- /* *** texture_map {
- [ 0.03
- pigment {
- color rgb 1
- }
- finish {
- ambient 1
- }
- normal {
- facets size 0.1
- }
- ]
- [ 0.04
- pigment {
- color rgbf <1, 1, 1, 0.9>
- }
- finish {
- reflection { 0.2 }
- specular 0.1
- roughness 0.02
- conserve_energy
- }
- normal {
- facets size 0.1
- }
- ]
- } *** */
- }
- interior {
- ior 1.3
- }
- }
-#end
-
-union {
- #declare Size = 4;
- #declare I = -Size;
- #while (I <= Size)
- #declare J = -Size;
-
- #while (J <= Size)
- #declare K = -Size;
-
- #while (K <= Size)
- object {
- sph(<2.5*I, 2.5*K, 2.5*J>)
- }
-
- #declare K = K + 1;
- #end
-
- #declare J = J + 1;
- #end
-
- #declare I = I + 1;
- #end
-}
diff --git a/bench/dimension/parse.sh b/bench/dimension/parse.sh
deleted file mode 100755
index b7db055..0000000
--- a/bench/dimension/parse.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-#########################################################################
-# Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> #
-# #
-# This file is part of The Dimension Benchmark Suite. #
-# #
-# The Dimension Benchmark Suite is free software; you can redistribute #
-# it and/or modify it under the terms of the GNU General Public License #
-# as published by the Free Software Foundation; either version 3 of the #
-# License, or (at your option) any later version. #
-# #
-# The Dimension Benchmark Suite is distributed in the hope that it will #
-# be useful, but WITHOUT ANY WARRANTY; without even the implied #
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See #
-# the GNU General Public License for more details. #
-# #
-# You should have received a copy of the GNU General Public License #
-# along with this program. If not, see <http://www.gnu.org/licenses/>. #
-#########################################################################
-
-for i in {1..10000}; do
- echo '
-difference {
- box {
- <-1, -1, -1>, <1, 1, 1>
-
- rotate 45*x
-
- texture {
- pigment {
- color rgbft <0, 0, 1, 0.25, 0.5>
- }
- finish {
- reflection { 0.5 }
- }
- }
-
- interior {
- ior 1.1
- }
- }
-
- sphere {
- <0, 0, 0>, 1.25
-
- texture {
- pigment {
- color rgb <0, 1, 0>
- }
- finish {
- phong 0.2
- phong_size 40.0
- }
- }
- }
-}
-'
-done | (time ${top_builddir}/dimension/dimension --parse /dev/stdin >/dev/null)
diff --git a/bench/dimension/render.sh b/bench/dimension/render.sh
deleted file mode 100755
index b661e53..0000000
--- a/bench/dimension/render.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-#########################################################################
-# Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> #
-# #
-# This file is part of The Dimension Benchmark Suite. #
-# #
-# The Dimension Benchmark Suite is free software; you can redistribute #
-# it and/or modify it under the terms of the GNU General Public License #
-# as published by the Free Software Foundation; either version 3 of the #
-# License, or (at your option) any later version. #
-# #
-# The Dimension Benchmark Suite is distributed in the hope that it will #
-# be useful, but WITHOUT ANY WARRANTY; without even the implied #
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See #
-# the GNU General Public License for more details. #
-# #
-# You should have received a copy of the GNU General Public License #
-# along with this program. If not, see <http://www.gnu.org/licenses/>. #
-#########################################################################
-
-echo -e "Single-threaded"
-time ${top_builddir}/dimension/dimension -w1920 -h1080 --quality=1 --threads=1 bench.pov
-echo -e "\nMulti-threaded"
-time ${top_builddir}/dimension/dimension -w1920 -h1080 --quality=1 bench.pov
diff --git a/bench/dimension/tokenize.sh b/bench/dimension/tokenize.sh
deleted file mode 100755
index 1d833d5..0000000
--- a/bench/dimension/tokenize.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#########################################################################
-# Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> #
-# #
-# This file is part of The Dimension Benchmark Suite. #
-# #
-# The Dimension Benchmark Suite is free software; you can redistribute #
-# it and/or modify it under the terms of the GNU General Public License #
-# as published by the Free Software Foundation; either version 3 of the #
-# License, or (at your option) any later version. #
-# #
-# The Dimension Benchmark Suite is distributed in the hope that it will #
-# be useful, but WITHOUT ANY WARRANTY; without even the implied #
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See #
-# the GNU General Public License for more details. #
-# #
-# You should have received a copy of the GNU General Public License #
-# along with this program. If not, see <http://www.gnu.org/licenses/>. #
-#########################################################################
-
-for i in {1..10000}; do
- echo '{}()[]+-*/,;?:&.|=<>!<= >= != "This is a string with escape sequences: \a\b\f\n\r\t\u2123\v\\\"" 1 123456789 01234567 0x123456789 -0x01 .1 0.1 1.0 0.123456789 -0.123456789 <1, 2.2, -3.03> Undefined'
-done | (time ${top_builddir}/dimension/dimension --tokenize /dev/stdin >/dev/null)
diff --git a/bench/libdimension/Makefile.am b/bench/libdimension/Makefile.am
deleted file mode 100644
index 353acb3..0000000
--- a/bench/libdimension/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-###########################################################################
-## Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> ##
-## ##
-## This file is part of The Dimension Build Suite. ##
-## ##
-## The Dimension Build Suite is free software; you can redistribute it ##
-## and/or modify it under the terms of the GNU General Public License as ##
-## published by the Free Software Foundation; either version 3 of the ##
-## License, or (at your option) any later version. ##
-## ##
-## The Dimension Build Suite is distributed in the hope that it will be ##
-## useful, but WITHOUT ANY WARRANTY; without even the implied warranty ##
-## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
-## General Public License for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program. If not, see <http://www.gnu.org/licenses/>. ##
-###########################################################################
-
-INCLUDES = -I$(top_srcdir)/libdimension
-
-EXTRA_PROGRAMS = bench-array \
- bench-geometry \
- bench-polynomial \
- bench-prtree
-
-AM_CFLAGS = $(libsandglass_CFLAGS) -fno-inline
-AM_LDFLAGS = $(libsandglass_LIBS) $(top_builddir)/libdimension/libdimension.la
-
-bench_array_SOURCES = array.c
-bench_geometry_SOURCES = geometry.c
-bench_polynomial_SOURCES = polynomial.c
-bench_prtree_SOURCES = prtree.c
-
-bench: $(EXTRA_PROGRAMS)
- ./bench-array
- ./bench-geometry
- ./bench-polynomial
- ./bench-prtree
-
-.PHONY: bench
diff --git a/bench/libdimension/array.c b/bench/libdimension/array.c
deleted file mode 100644
index 3fe0c83..0000000
--- a/bench/libdimension/array.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> *
- * *
- * This file is part of The Dimension Benchmark Suite. *
- * *
- * The Dimension Benchmark Suite is free software; you can redistribute *
- * it and/or modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Benchmark Suite is distributed in the hope that it will *
- * be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
- * the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-#include "dimension.h"
-#include <sandglass.h>
-#include <stdlib.h>
-#include <stdint.h>
-
-int
-main(void)
-{
- const unsigned int count = 32;
- uint32_t object = 1;
-
- sandglass_t sandglass;
- if (sandglass_init_monotonic(&sandglass, SANDGLASS_CPUTIME) != 0) {
- perror("sandglass_create()");
- return EXIT_FAILURE;
- }
-
- /* Benchmark allocation and deallocation */
- dmnsn_array *array;
- sandglass_bench_fine(&sandglass, {
- array = dmnsn_new_array(sizeof(object));
- dmnsn_delete_array(array);
- });
- printf("dmnsn_new_array() + dmnsn_delete_array(): %ld\n", sandglass.grains);
-
- /* Create our test array */
- array = dmnsn_new_array(sizeof(object));
-
- /* dmnsn_array_push() */
-
- printf("dmnsn_array_push():");
-
- for (unsigned int i = 0; i < count; ++i) {
- sandglass_bench_noprecache(&sandglass, dmnsn_array_push(array, &object));
- printf(" %ld", sandglass.grains);
- }
- printf("\n");
-
- /* 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() */
- sandglass_bench_fine(&sandglass, dmnsn_array_set(array, count/2, &object));
- printf("dmnsn_array_set(): %ld\n", sandglass.grains);
-
- /* 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() */
- 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(array, count);
- sandglass_bench_noprecache(&sandglass, dmnsn_array_resize(array, count * 2));
- printf("dmnsn_array_resize(): %ld", sandglass.grains);
-
- sandglass_bench_noprecache(&sandglass, dmnsn_array_resize(array, count));
- printf(" %ld\n", sandglass.grains);
-
- /* dmnsn_array_insert() */
-
- printf("dmnsn_array_insert():");
-
- for (size_t i = 0; i < count; ++i) {
- sandglass_bench_noprecache(&sandglass,
- dmnsn_array_insert(array, count/2, &object));
- printf(" %ld", sandglass.grains);
- }
- printf("\n");
-
- /* dmnsn_array_remove() */
-
- printf("dmnsn_array_remove():");
-
- for (size_t i = 0; i < count; ++i) {
- sandglass_bench_noprecache(&sandglass,
- dmnsn_array_remove(array, count/2));
- printf(" %ld", sandglass.grains);
- }
- printf("\n");
-
- /* dmnsn_array_pop() */
-
- printf("dmnsn_array_pop():");
-
- for (size_t i = 0; i < count; ++i) {
- sandglass_bench_noprecache(&sandglass, dmnsn_array_pop(array, &object));
- printf(" %ld", sandglass.grains);
- }
- printf("\n");
-
- dmnsn_delete_array(array);
- return EXIT_SUCCESS;
-}
diff --git a/bench/libdimension/geometry.c b/bench/libdimension/geometry.c
deleted file mode 100644
index 4b77c9b..0000000
--- a/bench/libdimension/geometry.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> *
- * *
- * This file is part of The Dimension Benchmark Suite. *
- * *
- * The Dimension Benchmark Suite is free software; you can redistribute *
- * it and/or modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Benchmark Suite is distributed in the hope that it will *
- * be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
- * the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-#include "dimension.h"
-#include <sandglass.h>
-#include <stdlib.h>
-
-int
-main(void)
-{
- dmnsn_vector vector, vector2;
- dmnsn_matrix matrix, matrix2;
- dmnsn_line line;
- double result;
-
- sandglass_t sandglass;
- if (sandglass_init_monotonic(&sandglass, SANDGLASS_CPUTIME) != 0) {
- perror("sandglass_create()");
- return EXIT_FAILURE;
- }
-
- /* 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() */
- sandglass_bench_fine(&sandglass, {
- matrix = 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);
- });
- printf("dmnsn_new_matrix(): %ld\n", sandglass.grains);
-
- /* dmnsn_identity_matrix() */
- sandglass_bench_fine(&sandglass, {
- matrix = dmnsn_identity_matrix();
- });
- printf("dmnsn_identity_matrix(): %ld\n", sandglass.grains);
-
- /* dmnsn_scale_matrix() */
- sandglass_bench_fine(&sandglass, {
- matrix = dmnsn_scale_matrix(vector);
- });
- printf("dmnsn_scale_matrix(): %ld\n", sandglass.grains);
-
- /* dmnsn_identity_matrix() */
- sandglass_bench_fine(&sandglass, {
- matrix = dmnsn_translation_matrix(vector);
- });
- printf("dmnsn_translation_matrix(): %ld\n", sandglass.grains);
-
- /* dmnsn_rotation_matrix() */
- sandglass_bench_fine(&sandglass, {
- matrix = dmnsn_rotation_matrix(vector);
- });
- printf("dmnsn_rotation_matrix(): %ld\n", sandglass.grains);
-
- /* 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() */
- sandglass_bench_fine(&sandglass, {
- vector = dmnsn_vector_add(vector, vector2);
- });
- printf("dmnsn_vector_add(): %ld\n", sandglass.grains);
-
- /* dmnsn_vector_sub() */
- sandglass_bench_fine(&sandglass, {
- vector = dmnsn_vector_sub(vector, vector2);
- });
- printf("dmnsn_vector_sub(): %ld\n", sandglass.grains);
-
- /* 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() */
- sandglass_bench_fine(&sandglass, {
- vector = dmnsn_vector_div(vector, 2.0);
- });
- printf("dmnsn_vector_div(): %ld\n", sandglass.grains);
-
- /* dmnsn_vector_cross() */
- sandglass_bench_fine(&sandglass, {
- vector = dmnsn_vector_cross(vector, vector2);
- });
- printf("dmnsn_vector_cross(): %ld\n", sandglass.grains);
-
- /* dmnsn_vector_dot() */
- sandglass_bench_fine(&sandglass, {
- result = dmnsn_vector_dot(vector, vector2);
- });
- printf("dmnsn_vector_dot(): %ld\n", sandglass.grains);
-
- /* dmnsn_vector_norm() */
- sandglass_bench_fine(&sandglass, {
- result = dmnsn_vector_norm(vector);
- });
- printf("dmnsn_vector_norm(): %ld\n", sandglass.grains);
-
- /* dmnsn_vector_normalize() */
- sandglass_bench_fine(&sandglass, {
- vector = dmnsn_vector_normalize(vector);
- });
- printf("dmnsn_vector_normalize(): %ld\n", sandglass.grains);
-
- /* dmnsn_matrix_inverse() */
- sandglass_bench_fine(&sandglass, {
- matrix = dmnsn_matrix_inverse(matrix);
- });
- printf("dmnsn_matrix_inverse(): %ld\n", sandglass.grains);
-
- /* 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);
- sandglass_bench_fine(&sandglass, {
- matrix = dmnsn_matrix_inverse(matrix2);
- });
- printf("dmnsn_matrix_inverse(HARD): %ld\n", sandglass.grains);
-
- /* dmnsn_matrix_mul() */
- sandglass_bench_fine(&sandglass, {
- matrix = dmnsn_matrix_mul(matrix, matrix2);
- });
- printf("dmnsn_matrix_mul(): %ld\n", sandglass.grains);
-
- /* dmnsn_transform_vector() */
- sandglass_bench_fine(&sandglass, {
- vector = dmnsn_transform_vector(matrix, vector);
- });
- printf("dmnsn_transform_vector(): %ld\n", sandglass.grains);
-
- /* dmnsn_transform_line() */
- sandglass_bench_fine(&sandglass, {
- line = dmnsn_transform_line(matrix, line);
- });
- printf("dmnsn_transform_line(): %ld\n", sandglass.grains);
-
- /* dmnsn_line_point() */
- sandglass_bench_fine(&sandglass, {
- vector = dmnsn_line_point(line, result);
- });
- printf("dmnsn_line_point(): %ld\n", sandglass.grains);
-
- return EXIT_SUCCESS;
-}
diff --git a/bench/libdimension/polynomial.c b/bench/libdimension/polynomial.c
deleted file mode 100644
index 0313060..0000000
--- a/bench/libdimension/polynomial.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> *
- * *
- * This file is part of The Dimension Benchmark Suite. *
- * *
- * The Dimension Benchmark Suite is free software; you can redistribute *
- * it and/or modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Benchmark Suite is distributed in the hope that it will *
- * be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
- * the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-#include "dimension.h"
-#include <sandglass.h>
-#include <stdlib.h>
-
-int
-main(void)
-{
-#define NPOLY 5
- double p[NPOLY][NPOLY + 1], x[NPOLY];
-
- /* 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][2] = 1.0;
- p[1][1] = 0.0;
- p[1][0] = -0.25;
-
- /* 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][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][5] = 1.0;
- p[4][4] = -107.5801;
- p[4][3] = 770.2260432;
- p[4][2] = -1215.2863928;
- p[4][1] = -646.270936;
- p[4][0] = 1447.8216;
-
- sandglass_t sandglass;
- if (sandglass_init_monotonic(&sandglass, SANDGLASS_CPUTIME) != 0) {
- perror("sandglass_create()");
- return EXIT_FAILURE;
- }
-
- for (size_t i = 0; i < NPOLY; ++i) {
- sandglass_bench_fine(&sandglass, dmnsn_solve_polynomial(p[i], i + 1, x));
- printf("dmnsn_solve_polynomial(x^%zu): %ld\n", i + 1, sandglass.grains);
- }
-
- return EXIT_SUCCESS;
-}
diff --git a/bench/libdimension/prtree.c b/bench/libdimension/prtree.c
deleted file mode 100644
index b6f778a..0000000
--- a/bench/libdimension/prtree.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> *
- * *
- * This file is part of The Dimension Benchmark Suite. *
- * *
- * The Dimension Benchmark Suite is free software; you can redistribute *
- * it and/or modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Benchmark Suite is distributed in the hope that it will *
- * be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
- * the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-#include "dimension-impl.h"
-#include <sandglass.h>
-#include <stdlib.h>
-
-static bool
-dmnsn_fake_intersection_fn(const dmnsn_object *object, dmnsn_line line,
- dmnsn_intersection *intersection)
-{
- intersection->t = (object->bounding_box.min.z - line.x0.z)/line.n.z;
- intersection->normal = dmnsn_x;
- return true;
-}
-
-static bool
-dmnsn_fake_inside_fn(const dmnsn_object *object, dmnsn_vector point)
-{
- return true;
-}
-
-static void
-dmnsn_randomize_bounding_box(dmnsn_object *object)
-{
- dmnsn_vector a, b;
-
- a.x = 2.0*((double)rand())/RAND_MAX - 1.0;
- a.y = 2.0*((double)rand())/RAND_MAX - 1.0;
- a.z = 2.0*((double)rand())/RAND_MAX - 1.0;
-
- b.x = 2.0*((double)rand())/RAND_MAX - 1.0;
- b.y = 2.0*((double)rand())/RAND_MAX - 1.0;
- b.z = 2.0*((double)rand())/RAND_MAX - 1.0;
-
- object->bounding_box.min = dmnsn_vector_min(a, b);
- object->bounding_box.max = dmnsn_vector_max(a, b);
-}
-
-static dmnsn_object *
-dmnsn_new_fake_object(void)
-{
- dmnsn_object *object = dmnsn_new_object();
- /* Generate a bounding box in (-1, -1, -1), (1, 1, 1) */
- dmnsn_randomize_bounding_box(object);
- object->intersection_fn = dmnsn_fake_intersection_fn;
- object->inside_fn = dmnsn_fake_inside_fn;
- return object;
-}
-
-int
-main(void)
-{
- const size_t nobjects = 10000;
-
- sandglass_t sandglass;
- if (sandglass_init_monotonic(&sandglass, SANDGLASS_CPUTIME) != 0) {
- perror("sandglass_create()");
- return EXIT_FAILURE;
- }
-
- dmnsn_array *objects = dmnsn_new_array(sizeof(dmnsn_object *));
- for (size_t i = 0; i < nobjects; ++i) {
- dmnsn_object *object = dmnsn_new_fake_object();
- dmnsn_initialize_object(object);
- dmnsn_array_push(objects, &object);
- }
-
- dmnsn_prtree *tree;
- sandglass_bench_noprecache(&sandglass, {
- tree = dmnsn_new_prtree(objects);
- });
- printf("dmnsn_new_prtree(): %ld\n", sandglass.grains);
-
- /* dmnsn_prtree_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)
- );
- dmnsn_intersection intersection;
-
- sandglass_bench_fine(&sandglass, {
- dmnsn_prtree_intersection(tree, ray, &intersection, true);
- });
- printf("dmnsn_prtree_intersection(): %ld\n", sandglass.grains);
-
- /* dmnsn_prtree_inside() */
- sandglass_bench_fine(&sandglass, {
- dmnsn_prtree_inside(tree, dmnsn_zero);
- });
- printf("dmnsn_prtree_inside(): %ld\n", sandglass.grains);
-
- /* Cleanup */
- dmnsn_delete_prtree(tree);
- for (size_t i = 0; i < nobjects; ++i) {
- dmnsn_object *object;
- dmnsn_array_get(objects, i, &object);
- dmnsn_delete_object(object);
- }
-
- dmnsn_delete_array(objects);
- return EXIT_SUCCESS;
-}