Re: commit: Fix 100% CPU usage hovering over large inline images.

From: <msevior_at_physics.unimelb.edu.au>
Date: Sun Mar 13 2005 - 14:37:14 CET

>
>> We used to make a copy of the image every the mouse moved! I fixed this
>> to
>> make a copy just the first time.
>
> Why would we want to copy an image at all? If it's for dragging the
> image around, then it's undeeded, as my 'old' code didn't need a copy at
> all.

True. This was a side effect of cutting and pasting the FrameEdit code.
I'll fix it eventually.

>
>> On the other hand it is *really* slow to import these big jpg's (about 3
>> megapixels.). It might be possible to speed things up by tweaking the
>> gdk-pixbuf-loader parameters.
>>
>
> I suspect our importer is to blame, not gdk-pixbuf
>

I looked at the code. The slowness appears to be because we're creating a
big png buffer at a very high compression factor. This is defiantely not
worth the CPU cycles as it appears to only increase the compression level
by about 1% at the cost of 5 times more CPU.

You can see this effect with the gimp. Load a big image file (like what
you get froma common digitial camera). Save as png at compression level 3
then at 9.

Look at the difference in size, feel the difference in time.

Unfortunately my attempts to change the compression level via libpng have
failed.

I just used the call...

        png_set_compression_level(m_pPNG,3); // 3 is much faster and keeps a
reasonable size

inside
void IE_ImpGraphic_GdkPixbuf::_createPNGFromPixbuf(GdkPixbuf * pixbuf)
{

Right before the png buffer is created here.

        png_set_compression_level(m_pPNG,3); // 3 is much faster and keeps a
reasonable size
        UT_Byte* pngScanline = new UT_Byte[rowstride];
        UT_DEBUGMSG(("COnverting pixbuf to png \n"));
        for(UT_uint32 i =0; i < height; i++)
        {
                memmove(pngScanline,pBuf,rowstride);
                png_write_row(m_pPNG, pngScanline);
                pBuf += rowstride;
        }
        UT_DEBUGMSG(("Conversion over \n"));

Any ideas folks?

Thanks!

Martin

Which looks like it should do the trick (and the libpng documentation also
says it should) but unfortunately it makes
> Thanks for workin on this!
> Marc
>
>
Received on Sun Mar 13 14:38:06 2005

This archive was generated by hypermail 2.1.8 : Sun Mar 13 2005 - 14:38:07 CET