<div dir="ltr"><div>The last Thursday and Friday, manuq and I worked together to try to find </div><div>the source of a few performance issues in Sugar.</div><div><br></div><div>In particular, we worked in the treeviews, for the activities list</div>
<div>and the Journal.</div><div><br></div><div>We did many, many tests, and learned a few tricks, here is a first summary.</div><div>The patches are not ready to push upstream, but we will continue working on this<br></div>
<div>in the next weeks. You can look at the branches here [1] and [2]</div><div><br></div><div>Findings:</div><div><br></div><div>* We did test programs to test the treeview and profile it doing:</div><div><br></div><div>
python -m cProfile test_treeview.py > profile.txt<br></div><div><br></div><div>This was very useful. We did tests to profile the scroll and to start the journal as a new</div><div>application in a terminal. [3]</div><div>
<br></div><div>* The source of the performance issues in the treeview is the CellRendererIcon,</div><div>a treeview without it works ok.</div><div><br></div><div>* The CellRendererIcon do a lot of unneeded work, the render method can be optimized,</div>
<div>caching values.</div><div><br></div><div>* The CellRendererIcon is connected to many signals, just detaching them while scrolling</div><div>solves part of the problem. To do it, we implemented a ScrollingDetector class.</div>
<div><br></div><div>* The CellRendererIcon is not a widget, then, do not receive events when the mouse </div><div>enter or leaves, and all the logic in the CellRendererInvoker is more complex than </div><div>should be. Worst, we had 6 different CellRendererIcons in the </div>
<div>Journal, then we simplified (and solved issues) implementing a TreeViewInvoker.</div><div>The TreeView knows where is every cell. While is much more simple and responsive,</div><div>implementation is not finished yet. </div>
<div><br></div><div>* The ObjectPalettes was created in the mouse enter callback, then if a user moved</div><div>the mouse cursor over the activity icons., many palettes were created, and that was </div><div>expensive [4].</div>
<div><br></div><div>* This changes make the activity list work really fast. The Journal no longer freeze</div><div>if a user move the mouse over the activity icons, but the scroll is still slowing at one point.</div><div>
First we thought that was because of the datastore, but we found the journal request first </div><div>30 records, and later add 10 records more, and caches the last 50. Trying with a journal</div><div>with less than 30 records we still see a moment when the Journal scroll jumps,</div>
<div>but the datastore is not working. We find a suspicious method "send_message_with_reply_and_block" doing the profiling, but we didn't found </div><div>where is used of is responsible of the problem.</div>
<div><br></div><div>As you can see, this is only a start. We will prepare a wiki page with the information</div><div>when is more clean, but wanted to share our findings, with the community.</div><div>Was really great work together in this issue in the same place,</div>
<div>I wonder if we can find a way to organize virtual hackatons by topics like this.</div><div><br></div><div>Regards,</div><div><br></div>-- <br><div dir="ltr"><br></div><div dir="ltr">[1] <a href="https://github.com/manuq/sugar-toolkit-gtk3/commits/scrollingdetector">https://github.com/manuq/sugar-toolkit-gtk3/commits/scrollingdetector</a></div>
<div dir="ltr">[2] <a href="https://github.com/manuq/sugar/commits/treeviews-optimizations">https://github.com/manuq/sugar/commits/treeviews-optimizations</a></div><div dir="ltr">[3] <a href="http://blog.ludovf.net/python-profiling-cprofile/">http://blog.ludovf.net/python-profiling-cprofile/</a></div>
<div dir="ltr">[4] <a href="http://bugs.sugarlabs.org/ticket/4343">http://bugs.sugarlabs.org/ticket/4343</a></div><div dir="ltr"><br></div><div dir="ltr">Gonzalo Odiard<br><br><div>SugarLabs - Learning Software for children<br>
</div></div>
</div>