GdkPixbufLoader vs. _from_file: speed issue



I am trying to load an image, and I am comparing two methods: a plain
gdk_pixbuf_new_from_file, and a GdkPixbufLoader with a
fread/gdk_pixbuf_loader_write loop. I am very surprised by the difference of
efficiency of both methods: with my sample image, on the computer I am
using, gdk_pixbuf_new_from_file takes only about 3.5 seconds, while the
GdkPixbufLoader method takes about 22 seconds. I understand that keeping
track of the current state and keeping the data structure consistent across
calls must take some time, but I expected a 10% cost, not a 500% cost!

To have things right, here are some details:

- There is no swap/out of memory problems, all is well within the cache and
  free memory limit, and the limiting factor is really CPU.

- Almost all the time is spent in gdk_pixbuf_loader_write. In particular, I
  am not wasting time in the loop system since all the file is read in just
  4 big fread.

- There is no signal for area-updated; adding a no-op one costs two more
  seconds.

- It is a Gtk+ 2.6.8-1 from Debian, on a Pentium 266. I did not find
  anything pertinent in the ChangeLog to expect better with 2.8.1.

I intended to use a GdkPixbufLoader to do partial rendering while loading a
big image, but if it means that the user must wait six times what he would
have waited otherwise, it is somewhat defeating the purpose.

Did I miss something?

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]