summaryrefslogtreecommitdiff
path: root/test/test-eel-pixbuf-scale.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-11-12 13:30:05 +0100
committerraveit65 <[email protected]>2020-11-24 22:28:30 +0100
commite69fc06d75d2d9a2ba2239791196dcc48801ab68 (patch)
treebac7b3bcbe27e326b8cbd60ca312c3de40f014a7 /test/test-eel-pixbuf-scale.c
parente991c05debb9a907ac5d17e17dba2b2c275632d3 (diff)
downloadcaja-e69fc06d75d2d9a2ba2239791196dcc48801ab68.tar.bz2
caja-e69fc06d75d2d9a2ba2239791196dcc48801ab68.tar.xz
test-eel-pixbuf-scale: Profile only the scaling functions just once
Diffstat (limited to 'test/test-eel-pixbuf-scale.c')
-rw-r--r--test/test-eel-pixbuf-scale.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/test/test-eel-pixbuf-scale.c b/test/test-eel-pixbuf-scale.c
index a46448b0..2aa10ecf 100644
--- a/test/test-eel-pixbuf-scale.c
+++ b/test/test-eel-pixbuf-scale.c
@@ -2,8 +2,6 @@
#include "test.h"
-#define N_SCALES 100
-
#define DEST_WIDTH 32
#define DEST_HEIGHT 32
@@ -13,7 +11,6 @@ main (int argc, char* argv[])
GdkPixbuf *pixbuf, *scaled;
GError *error;
gint64 t1, t2;
- int i;
test_init (&argc, &argv);
@@ -35,34 +32,22 @@ main (int argc, char* argv[])
(double)gdk_pixbuf_get_height(pixbuf)/DEST_HEIGHT);
t1 = g_get_monotonic_time ();
- for (i = 0; i < N_SCALES; i++) {
- scaled = eel_gdk_pixbuf_scale_down (pixbuf, DEST_WIDTH, DEST_HEIGHT);
- g_object_unref (scaled);
- }
+ scaled = eel_gdk_pixbuf_scale_down (pixbuf, DEST_WIDTH, DEST_HEIGHT);
t2 = g_get_monotonic_time ();
- g_print ("Time for eel_gdk_pixbuf_scale_down: %" G_GINT64_FORMAT " msecs\n",
- (t2 - t1) / G_TIME_SPAN_MILLISECOND);
-
-
+ g_object_unref (scaled);
+ g_print ("Time for eel_gdk_pixbuf_scale_down: %" G_GINT64_FORMAT " usecs\n", t2 - t1);
t1 = g_get_monotonic_time ();
- for (i = 0; i < N_SCALES; i++) {
- scaled = gdk_pixbuf_scale_simple (pixbuf, DEST_WIDTH, DEST_HEIGHT, GDK_INTERP_NEAREST);
- g_object_unref (scaled);
- }
+ scaled = gdk_pixbuf_scale_simple (pixbuf, DEST_WIDTH, DEST_HEIGHT, GDK_INTERP_NEAREST);
t2 = g_get_monotonic_time ();
- g_print ("Time for INTERP_NEAREST: %" G_GINT64_FORMAT " msecs\n",
- (t2 - t1) / G_TIME_SPAN_MILLISECOND);
-
+ g_object_unref (scaled);
+ g_print ("Time for INTERP_NEAREST: %" G_GINT64_FORMAT " usecs\n", t2 - t1);
t1 = g_get_monotonic_time ();
- for (i = 0; i < N_SCALES; i++) {
- scaled = gdk_pixbuf_scale_simple (pixbuf, DEST_WIDTH, DEST_HEIGHT, GDK_INTERP_BILINEAR);
- g_object_unref (scaled);
- }
+ scaled = gdk_pixbuf_scale_simple (pixbuf, DEST_WIDTH, DEST_HEIGHT, GDK_INTERP_BILINEAR);
t2 = g_get_monotonic_time ();
- g_print ("Time for INTERP_BILINEAR: %" G_GINT64_FORMAT " msecs\n",
- (t2 - t1) / G_TIME_SPAN_MILLISECOND);
+ g_object_unref (scaled);
+ g_print ("Time for INTERP_BILINEAR: %" G_GINT64_FORMAT " usecs\n", t2 - t1);
scaled = eel_gdk_pixbuf_scale_down (pixbuf, DEST_WIDTH, DEST_HEIGHT);
gdk_pixbuf_save (scaled, "eel_scaled.png", "png", NULL, NULL);