After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 99696 - Unnecessary context switches in Stock Ticker applet
Unnecessary context switches in Stock Ticker applet
Status: RESOLVED FIXED
Product: gnome-applets
Classification: Other
Component: general
2.0.x
Other opensolaris
: Normal normal
: ---
Assigned To: gnome-applets Maintainers
gnome-applets Maintainers
Depends on:
Blocks:
 
 
Reported: 2002-11-27 10:47 UTC by Brian Nitz
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Brian Nitz 2002-11-27 10:47:08 UTC
Two problems cause this applet to use much more CPU than it should.

1) New GCs are constructed during every repaint instead of being reused.
gtik.c:


574                 bg = gdk_gc_new (stockdata->pixmap);
575                 gdk_gc_set_foreground( bg, &stockdata->gdkBGcolor );
576                 gdk_draw_rectangle (stockdata->pixmap,
577                                     bg, TRUE, 0,0,
578                                     drawing_area->allocation.width,
579                                     drawing_area->allocation.height);
580                 g_object_unref (bg);


  
2) 5 ms sleeps are much too short.
Comment 1 Stephen Browne 2002-11-27 10:52:26 UTC
*** Bug 99632 has been marked as a duplicate of this bug. ***
Comment 2 Stephen Browne 2002-11-27 10:53:23 UTC
*** Bug 99632 has been marked as a duplicate of this bug. ***
Comment 3 Kevin Vandersloot 2002-11-27 15:51:59 UTC
In 2.1 you can now change the speed at which it displays to something
more than 5ms. I think I made the default interval to something longer
than 5 ms. 1) should be easy to fix - thanks for pointing that out!

The problem with the 5ms is how to get it to scroll smoothly and zoom
by fast enough (since some people might want it to scroll by fast). In
2.1 I cahnged the interval to 20ms I think, but made it scroll
sideways by 2 pixels instead of just one pixel. I looks a little more
choppy if it scrolls by 2 pixels though.

Maybe in the future we should change this appplet to display one stock
at a time, and just cycle through the stocks. I think that would be
better. That would solve all the cpu issues also.
Comment 4 Kevin Vandersloot 2002-11-27 22:54:24 UTC
The new gc's creation is now fixed in cvs.

I did some tweaking in the stable branch. Performance is much better,
though I made it scroll a bit slower.

This bug should be fixed now. Please reopen if it's still unacceptable.
Comment 5 Kjartan Maraas 2004-10-18 15:52:18 UTC
Moving reports from obsolete component 'odometer' to 'general'.