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 312653 - Improving UndoManager performances (bad use of GList)
Improving UndoManager performances (bad use of GList)
Status: RESOLVED INCOMPLETE
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other All
: High major
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on: 326622
Blocks:
 
 
Reported: 2005-08-05 09:42 UTC by Paolo Maggi
Modified: 2009-12-04 04:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
improve action list freeing (4.15 KB, patch)
2005-10-27 20:10 UTC, Paolo Borelli
none Details | Review
fix brown paper bug in previous patch :/ (4.18 KB, patch)
2005-10-29 18:14 UTC, Paolo Borelli
committed Details | Review

Description Paolo Maggi 2005-08-05 09:42:11 UTC
Looking at the code of the undo manager I have seen it uses GList in a very bad way.

We could for example cache the length of the undo list (removing all the calls
to g_list_length) and the pointer to the last element (removing the calls to
g_list_last).

We also use g_list_nth_data inside cycles (see gtk_source_undo_manager_undo and
gtk_source_undo_manager_free_action_list). 

Since we usually use g_list_nth[_data] using next_redo as parameter, we could
cache a pointer to the list element with index next_redo.

We should also investigare the use of g_list_delete_link
Comment 1 Paolo Borelli 2005-10-27 20:10:35 UTC
Created attachment 53963 [details] [review]
improve action list freeing

I finally took a quick look at this, and noticed that the way the action list
is freed is embarassing: to free a list gets the length of the list and then in
a for loop gets the nth element! ugh.

The patch factors out a function to free an action (a good idea on its own) and
then simply walks the list and frees the elements.
The free_action function is then used in other spots of the file.

Only lightly tested, but seems straightforward, unless I am missing
something...


[obviously more of the above optimization ideas should be implemnted]
Comment 2 Paolo Borelli 2005-10-29 18:14:15 UTC
Created attachment 54052 [details] [review]
fix brown paper bug in previous patch :/
Comment 3 João Matos 2008-02-15 15:16:59 UTC
Is this bug still valid?
Comment 4 Javier Jardón (IRC: jjardon) 2009-05-29 00:25:20 UTC
Dear hackers, 

Any news on this bug ?

regards
Comment 5 André Klapper 2009-05-29 10:33:43 UTC
Patch is set to committed.
NEEDINFO as per the last two comments.
Comment 6 Akhil Laddha 2009-12-04 04:58:11 UTC
Closing this bug report as no further information has been provided. Please 
feel free to reopen the bug if the problem still occurs with a newer
version of GNOME 2.28.0 or later, thanks.