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.
parent 0ab81824
......@@ -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
......
HEAD
master~10..master
master~15..master
# enable multi-thread by default
......
......@@ -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,
......
#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 ();
}
......
#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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment