Wasted work in SuggestMgr::twowords()

RESOLVED FIXED in mozilla33

Status

()

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: pchang9, Assigned: pchang9)

Tracking

({perf})

Trunk
mozilla33
x86_64
Windows 7
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed-in-hunspell-1.3.3])

Attachments

(3 attachments)

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).
Posted patch patch2.diffSplinter Review
Attachment #780736 - Flags: review?(pchang9)
Posted 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: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.