Bug 353121
| Summary: | [PATCH] ignore duplicate SpellError objects | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Dan Williams <dcbw> | ||||
| Component: | gtkhtml3 | Assignee: | Matthew Barnes <mbarnes> | ||||
| Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | rawhide | CC: | mcrha, rstrode | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2007-11-08 18:58:21 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
Dan Williams
2007-10-25 19:40:13 UTC
Created attachment 237881 [details]
ignore duplicates when adding spelling error objects to a line's spell_errors list
Using a 15375 character long line of multiple words (me pressing asdfgwer and space at random times) I couldn't determine a performance difference between patched and unpatched versions with a stopwatch. Each text line keeps track of it's own spell_list, so the speed impact of searching through the spell_errors list is usually nothing since most lines will have < 10 spelling errors, even if they are computery things like patches with lots of acronyms and non-english words. Ray; can you take a quick look at the patch too for more assurance that it's correct? Does linked list manipulation and I want to be sure it looks OK to a few people :) Looks like it should work. An alternate approach that avoids the linked list
manipulation might be to define a spell_errors_list_merge() function that
consumes two sorted GLists returns a new sorted GList, free of dupes.
Something roughly like (in Python):
def spell_errors_list_merge(L1, L2):
L3 = []
while L1 and L2:
if L1[0] < L2[0]: # se_cmp() < 0
n = L1.pop(0) # g_list_remove_link()
else:
n = L2.pop(0) # g_list_remove_link()
if not L3 or n != L3[0]: # se_cmp() != 0
L3.insert(0, n) # g_list_prepend()
L3.reverse() # g_list_reverse()
L3.extend(L1) # g_list_concat()
L3.extend(L2) # g_list_concat()
return L3
Pushing this upstream with a revised patch. See [1] for further updates. [1] http://bugzilla.gnome.org/show_bug.cgi?id=495073 |