Hi Monks!

I have been playing around with Tk and more specifically Tk::Zinc lately (718496); the way I understand it Tk::Zinc uses OpenGL (with -render=>1 of course), so the systems GPU should be doing the heavy lifting, right?

But doing a mouse drag on a Tk::Zinc (or, indeed, a regular canvas) uses a lot of CPU on my system, even with trivial <Motion> callbacks. Is this a known problem? Could it be an issue with my system?

I have a simple item that can be dragged with mouse on a fullscreen canvas/zinc. I grab it and drag it back and forth like a maniac.

Difference in CPU usage is not immediately visible on different resolutions, i.e. 1280x1024 is no better than 1920x1200.

Also, dragging a windowed Perl/Tk app with a packed zinc widget around uses much more CPU than dragging any other kind of window (double that of Perl/Tk without zinc). For comparison dragging a running 720p running mplayer window in the same fashion uses much less (~10%) cpu than dragging a simple rectangle within a pTk app (~20%), and certainly less than dragging a rectangle within Tk::Zinc (~50%).

My laptop is dual core 2ghz (intel), I think it should be sufficient to drag a rectangle..;-) I run latest ubuntu with default perl packages, everything else built from CPAN. Is it possible that compiling perl from source may help on this issue? Or is there simply nothing to do? :-\

This is a problem for me because I plan on doing important things in the background. I don't want to risk losing a lot of cycles to mouse movement.

Linux pvp 2.6.24-21-rt #1 SMP PREEMPT RT Mon Aug 25 19:24:40 UTC 2008 i686 GNU/Linux

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi

Thanks in advance.


In reply to Tk/Zinc mouse drag performance issues? by rocklee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.