[gegl] perf: add mipmap scaled fetch benchmarks
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] perf: add mipmap scaled fetch benchmarks
- Date: Sat, 20 Jan 2018 02:57:35 +0000 (UTC)
commit 8f8a802a48d246763ffd753014f1f003fe726cd8
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Jan 20 01:57:11 2018 +0100
perf: add mipmap scaled fetch benchmarks
Also scale down font-size of test names a bit, and tweak
iterations/bailing constants for greater measurement accuracy.
perf/create-report.rb | 4 +-
perf/joblist | 2 +-
perf/test-common.h | 11 +++----
perf/test-gegl-buffer-access.c | 57 +++++++++++++++++++++++++++++++++++-----
perf/test-samplers.c | 31 ++++++++++-----------
5 files changed, 73 insertions(+), 32 deletions(-)
---
diff --git a/perf/create-report.rb b/perf/create-report.rb
index eda15d9..2c2370b 100755
--- a/perf/create-report.rb
+++ b/perf/create-report.rb
@@ -180,8 +180,8 @@ class Database
max = val_max(key)
cr.set_source_rgba(@colors[valno])
- cr.move_to(@width - @marginrx + @rgap, valno * 18 + @marginy + 20)
- cr.set_font_size(18)
+ cr.move_to(@width - @marginrx + @rgap/2, valno * 12 + @marginy + 20)
+ cr.set_font_size(12)
cr.show_text(key)
cr.line_width = 2
diff --git a/perf/joblist b/perf/joblist
index 4ce5e04..b5d2849 100644
--- a/perf/joblist
+++ b/perf/joblist
@@ -1,6 +1,6 @@
HEAD
-master~10..master
+master~15..master
# enable multi-thread by default
diff --git a/perf/test-common.h b/perf/test-common.h
index 0328d51..66e38e6 100644
--- a/perf/test-common.h
+++ b/perf/test-common.h
@@ -3,13 +3,13 @@
#include "gegl.h"
#include "opencl/gegl-cl-init.h"
-#define ITERATIONS 200
-#define PERCENTILE 0.8 /* if we want to bias to the better results with
+#define ITERATIONS 600
+#define PERCENTILE 0.75 /* if we want to bias to the better results with
more noise, increase this number towards 1.0,
like 0.8 */
-#define BAIL_THRESHOLD 0.01
-#define BAIL_COUNT 10
-#define MIN_ITER 16
+#define BAIL_THRESHOLD 0.002
+#define BAIL_COUNT 150
+#define MIN_ITER 20
static long ticks_start;
@@ -155,7 +155,6 @@ void do_bench (const gchar *id,
test_end_iter();
}
test_end_suffix (id, suffix, ((double)gegl_buffer_get_pixel_count (buffer)) * 16 * ITERATIONS);
-#undef ITERATIONS
}
void bench (const gchar *id,
diff --git a/perf/test-gegl-buffer-access.c b/perf/test-gegl-buffer-access.c
index d6f4b10..1a1d61b 100644
--- a/perf/test-gegl-buffer-access.c
+++ b/perf/test-gegl-buffer-access.c
@@ -1,22 +1,21 @@
#include "test-common.h"
#define BPP 16
-#define ITERATIONS 200
gint
main (gint argc,
gchar **argv)
{
GeglBuffer *buffer;
- GeglRectangle bound = {0, 0, 2048, 2048};
+ GeglRectangle bound = {0, 0, 1024, 1024};
const Babl *format;
gchar *buf;
gint i;
gegl_init (NULL, NULL);
format = babl_format ("RGBA float");
- buffer = gegl_buffer_new (&bound, format);
buf = g_malloc0 (bound.width * bound.height * BPP);
+ buffer = gegl_buffer_new (&bound, format);
/* pre-initialize */
gegl_buffer_set (buffer, &bound, 0, NULL, buf, GEGL_AUTO_ROWSTRIDE);
@@ -30,6 +29,54 @@ main (gint argc,
}
test_end ("gegl_buffer_get", 1.0 * bound.width * bound.height * ITERATIONS * BPP);
+ test_start ();
+ for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
+ {
+ GeglBuffer *buffer = gegl_buffer_new (&bound, format);
+ /* pre-initialize */
+ gegl_buffer_set (buffer, &bound, 0, NULL, buf, GEGL_AUTO_ROWSTRIDE);
+ test_start_iter ();
+ gegl_buffer_get (buffer, &bound, 0.333, NULL, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+ test_end_iter ();
+ g_object_unref (buffer);
+ }
+ test_end ("gegl_buffer_get 0.333", 1.0 * bound.width * bound.height * ITERATIONS * BPP);
+
+ {
+
+ test_start ();
+ for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
+ {
+ const Babl *format = babl_format ("R'G'B'A u8");
+ GeglBuffer *buffer = gegl_buffer_new (&bound, format);
+ gegl_buffer_set (buffer, &bound, 0, NULL, buf, GEGL_AUTO_ROWSTRIDE);
+ /* pre-initialize */
+ test_start_iter ();
+ gegl_buffer_get (buffer, &bound, 0.333, NULL, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+ test_end_iter ();
+ g_object_unref (buffer);
+ }
+ }
+ test_end ("gegl_buffer_get 8bit 0.333", 1.0 * bound.width * bound.height * ITERATIONS * 4);
+
+
+ {
+
+ const Babl *format = babl_format ("R'G'B'A u8");
+ GeglBuffer *buffer = gegl_buffer_new (&bound, format);
+ gegl_buffer_set (buffer, &bound, 0, NULL, buf, GEGL_AUTO_ROWSTRIDE);
+ test_start ();
+ for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
+ {
+ /* pre-initialize */
+ test_start_iter ();
+ gegl_buffer_get (buffer, &bound, 0.333, NULL, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+ test_end_iter ();
+ }
+ g_object_unref (buffer);
+ }
+ test_end ("gegl_buffer_getC8bit 0.333", 1.0 * bound.width * bound.height * ITERATIONS * 4);
+
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -66,12 +113,8 @@ main (gint argc,
int x = rands[j*2];
int y = rands[j*2+1];
float px[4] = {0.2, 0.4, 0.1, 0.5};
-#if 1
GeglRectangle rect = {x, y, 1, 1};
gegl_buffer_set (buffer, &rect, 0, format, (void*)&px[0], GEGL_AUTO_ROWSTRIDE);
-#else
- gegl_buffer_set_pixel (buffer, x, y, format, (void*)&px[0], 3);
-#endif
}
test_end_iter ();
}
diff --git a/perf/test-samplers.c b/perf/test-samplers.c
index 76fd96c..1ee2f7a 100644
--- a/perf/test-samplers.c
+++ b/perf/test-samplers.c
@@ -1,7 +1,7 @@
#include "test-common.h"
#define BPP 16
-#define ITERATIONS 100
+#define SAMPLES 250000
gint
main (gint argc,
@@ -25,7 +25,6 @@ main (gint argc,
format = babl_format ("RGBA float");
{
-#define SAMPLES 150000
gint rands[SAMPLES*2];
for (i = 0; i < SAMPLES; i ++)
@@ -52,7 +51,7 @@ main (gint argc,
}
test_end_iter();
}
- test_end ("gegl_buffer_get 1x1 + babl", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_buffer_get 1x1 + babl", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -69,7 +68,7 @@ main (gint argc,
}
test_end_iter();
}
- test_end ("gegl_buffer_sample nearest", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_buffer_sample nearest", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -86,7 +85,7 @@ main (gint argc,
}
test_end_iter();
}
- test_end ("gegl_buffer_sample near+ba", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_buffer_sample near+ba", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -107,7 +106,7 @@ main (gint argc,
test_end_iter();
g_object_unref (sampler);
}
- test_end ("gegl_sampler_get nearest", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_sampler_get nearest", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -129,7 +128,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("sampler_get_fun nearest", SAMPLES * ITERATIONS * BPP);
+ test_end ("sampler_get_fun nearest", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
@@ -152,7 +151,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("sampler_get_fun nearest+babl", SAMPLES * ITERATIONS * BPP);
+ test_end ("sampler_get_fun nearest+babl", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
@@ -170,7 +169,7 @@ main (gint argc,
}
test_end_iter();
}
- test_end ("gegl_buffer_sample linear", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_buffer_sample linear", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -191,7 +190,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("gegl_sampler_get linear", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_sampler_get linear", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -213,7 +212,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("sampler_get_fun linear", SAMPLES * ITERATIONS * BPP);
+ test_end ("sampler_get_fun linear", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -230,7 +229,7 @@ main (gint argc,
}
test_end_iter();
}
- test_end ("gegl_buffer_sample cubic", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_buffer_sample cubic", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -251,7 +250,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("gegl_sampler_get cubic", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_sampler_get cubic", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -273,7 +272,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("sampler_get_fun cubic", SAMPLES * ITERATIONS * BPP);
+ test_end ("sampler_get_fun cubic", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -294,7 +293,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("gegl_sampler_get nohalo", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_sampler_get nohalo", 1.0 * SAMPLES * ITERATIONS * BPP);
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
@@ -315,7 +314,7 @@ main (gint argc,
g_object_unref (sampler);
}
- test_end ("gegl_sampler_get lohalo", SAMPLES * ITERATIONS * BPP);
+ test_end ("gegl_sampler_get lohalo", 1.0 * SAMPLES * ITERATIONS * BPP);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]