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 792455 - Improve docs of GSequence
Improve docs of GSequence
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-01-12 11:01 UTC by Sébastien Wilmet
Modified: 2018-01-16 19:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
docs: GSequence: better document how to sort large amount of data (4.93 KB, patch)
2018-01-12 11:02 UTC, Sébastien Wilmet
none Details | Review
docs: GSequence: better document how to sort large amount of data (4.93 KB, patch)
2018-01-15 19:45 UTC, Sébastien Wilmet
committed Details | Review

Description Sébastien Wilmet 2018-01-12 11:01:40 UTC
I'll attach a patch.
Comment 1 Sébastien Wilmet 2018-01-12 11:02:31 UTC
Created attachment 366717 [details] [review]
docs: GSequence: better document how to sort large amount of data

It was documented at strange places: in g_sequence_search*() and
g_sequence_lookup*(), but how to insert and sort data is not done by
those functions.

So instead, add the information to the class description (since it
involves several functions), and add also the information in
g_sequence_insert_sorted() and g_sequence_insert_sorted_iter() as a kind
of warning when using those functions.

Note that before this commit, it was not explained *why* it is better to
call g_sequence_sort() after doing a lot of unsorted insertions. Now it
is documented as "more efficient" (I think it's the only reason that
makes sense, otherwise why was it documented?).
Comment 2 Philip Withnall 2018-01-15 11:39:22 UTC
Review of attachment 366717 [details] [review]:

::: glib/gsequence.c
@@ +716,3 @@
+ * Note that when adding a large amount of data to a #GSequence,
+ * it is more efficient to do unsorted insertions and then
+ * calling g_sequence_sort() or g_sequence_sort_iter().

Nitpick: s/calling/call/

@@ +1009,3 @@
+ * Note that when adding a large amount of data to a #GSequence,
+ * it is more efficient to do unsorted insertions and then
+ * calling g_sequence_sort() or g_sequence_sort_iter().

Nitpick: s/calling/call/
Comment 3 Sébastien Wilmet 2018-01-15 19:45:19 UTC
Created attachment 366859 [details] [review]
docs: GSequence: better document how to sort large amount of data

It was documented at strange places: in g_sequence_search*() and
g_sequence_lookup*(), but how to insert and sort data is not done by
those functions.

So instead, add the information to the class description (since it
involves several functions), and add also the information in
g_sequence_insert_sorted() and g_sequence_insert_sorted_iter() as a kind
of warning when using those functions.

Note that before this commit, it was not explained *why* it is better to
call g_sequence_sort() after doing a lot of unsorted insertions. Now it
is documented as "more efficient" (I think it's the only reason that
makes sense, otherwise why was it documented?).
Comment 4 Philip Withnall 2018-01-16 12:37:21 UTC
Review of attachment 366859 [details] [review]:

Thanks
Comment 5 Sébastien Wilmet 2018-01-16 19:13:05 UTC
Thanks for the review!

Attachment 366859 [details] pushed as 3ee859d - docs: GSequence: better document how to sort large amount of data