Closed Bug 897780 Opened 12 years ago Closed 11 years ago

Wasted work in SuggestMgr::twowords()

Categories

(Core :: Spelling checker, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: pchang9, Assigned: pchang9)

References

Details

(Keywords: perf, Whiteboard: [fixed-in-hunspell-1.3.3])

Attachments

(3 files)

Attached patch Suggested patchSplinter Review
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0 (Beta/Release) Build ID: 20130116073211 Steps to reproduce: The problem appears in changeset 138350:18467a85acf6. I have attached a simple one-line patch that fixes it. In method SuggestMgr::twowords() in extensions/spellcheck/hunspell/src/suggestmgr.cpp, the loop on line 818 and 834 should break immediately after "cwrd" is set to "0". All the iterations after "cwrd" is set to "0" do not perform any useful work, at best they just set "cwrd" again to "0".
Keywords: perf
Version: 18 Branch → Trunk
Attachment #780728 - Flags: review?(pchang9)
Component: Untriaged → Spelling checker
Product: Firefox → Core
Similar problems appear in the same file on loops at line 163 and 421, where they should break after "cwrd" is set to "0" (patch2.diff); On loops at line 1385 and 1414, the loops should break after "unique" is set to "0" (patch3.diff).
Attached patch patch2.diffSplinter Review
Attachment #780736 - Flags: review?(pchang9)
Attached patch patch3.diffSplinter Review
Attachment #780737 - Flags: review?(pchang9)
pchang, better to request review from Caolan since he's an upstream Hunspell maintainer. But like Gavin said, these are all in an upstream library, so filing bugs there is probably a better idea.
looks good, committed to upstream HEAD now
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [fixed-in-hunspell-1.3.3]
Attachment #780728 - Attachment is patch: true
Attachment #780728 - Flags: review?(pchang9)
Attachment #780736 - Flags: review?(pchang9)
Attachment #780737 - Flags: review?(pchang9)
Fixed on mozilla-central by bug 1022262.
Assignee: nobody → pchang9
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: