summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-11-12 13:30:05 +0100
committerraveit65 <[email protected]>2022-07-21 19:33:49 +0200
commit3922281831b069c26f675520f135fb3ecc0e5429 (patch)
tree898f3a3d61862d6890ebf04d76cdf8f756964226
parent448390c4c0a78a792da6e699900eef945a20895b (diff)
downloadcaja-3922281831b069c26f675520f135fb3ecc0e5429.tar.bz2
caja-3922281831b069c26f675520f135fb3ecc0e5429.tar.xz
test-eel-pixbuf-scale: Profile only the scaling functions just once
-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 5524b354..862fa9ae 100644
--- a/test/test-eel-pixbuf-scale.c
+++ b/test/test-eel-pixbuf-scale.c
@@ -4,8 +4,6 @@
#include "test.h"
-#define N_SCALES 100
-
#define DEST_WIDTH 32
#define DEST_HEIGHT 32
@@ -15,7 +13,6 @@ main (int argc, char* argv[])
GdkPixbuf *pixbuf, *scaled;
GError *error;
gint64 t1, t2;
- int i;
test_init (&argc, &argv);
@@ -37,34 +34,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);