GNOME Bugzilla – Bug 99696
Unnecessary context switches in Stock Ticker applet
Last modified: 2004-12-22 21:47:04 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.
*** Bug 99632 has been marked as a duplicate of this bug. ***
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.
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.
Moving reports from obsolete component 'odometer' to 'general'.