sethhall / cld2

Automatically exported from code.google.com/p/cld2
0 stars 0 forks source link

Wasted work in cld::GetNormalizedScore() and cld::GetReliability() #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The problem appears in revision 215539. I have attached a simple one-line patch 
that fixes it.

In method cld::GetNormalizedScore() in cld/compact_lang_det/cldutil.cc, the 
loop in line 818 keeps overriding "expected_score" with "kMeanScore[cur_lang * 
4 + i]" when it is larger than zero. Therefore, only the last written value is 
visible out of the loop and all the other writes and iterations are not 
necessary. The patch iterates from the end of "i" and breaks the first time 
when "expected_score" is set.

Similar problem also appears in cld::GetReliability(), at line 846.

Original issue reported on code.google.com by pochang0...@gmail.com on 6 Aug 2013 at 8:45

GoogleCodeExporter commented 9 years ago
https://codereview.chromium.org/22321003/

Original comment by pochang0...@gmail.com on 6 Aug 2013 at 8:46

GoogleCodeExporter commented 9 years ago
This issue is about the original cld project (retronym: CLD1), not the current 
CLD2 project. cld is largely abandoned now. The performance bug described does 
not occur in CLD2. /dick

Original comment by dsi...@google.com on 9 Aug 2013 at 6:28

GoogleCodeExporter commented 9 years ago

Original comment by dsi...@google.com on 9 Aug 2013 at 6:39