[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.3.0-35-g49d4354



The following commit has been merged in the master branch:
commit 49d435490ba39434392e58efb4cd388740c6eaa7
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Wed Dec 30 18:03:41 2009 -0600

    Optimise spell-checking code by dropping call to length()
    
    Tightening the regex to only match {1,5} uppercase characters instead
    of first checking the length of the string and then matching any number
    of upper case characters is faster.
    
    This optimisation has an impact on words where the first character is
    not uppercase and those with more than five uppercase characters at the
    beginning of the word.

diff --git a/lib/Spelling.pm b/lib/Spelling.pm
index f8db712..557fcfb 100644
--- a/lib/Spelling.pm
+++ b/lib/Spelling.pm
@@ -626,7 +626,7 @@ sub spelling_check {
 
     for my $word (split(/\s+/, $text)) {
         $word =~ s/[.,;:?!]+$//;
-        next if (length($word) <= 5 and $word =~ /^[A-Z]+\z/);
+        next if ($word =~ /^[A-Z]{1,5}\z/);
         my $lcword = lc $word;
         if (exists $CORRECTIONS{$lcword}) {
             $counter++;

-- 
Debian package checker


Reply to: