Browse Source

Add patch by Teemu Koskinen to speed up karma parsing (SF #1489060).

Christoph Berg 20 years ago
parent
commit
4b1a0af65d
3 changed files with 5 additions and 2 deletions
  1. 2 0
      docs/CREDITS
  2. 1 0
      docs/Changelog
  3. 2 2
      modules/Pisg/Parser/Logfile.pm

+ 2 - 0
docs/CREDITS

@@ -148,6 +148,8 @@ Other contributors:
    | updated Turkish translation
    | updated Turkish translation
  * Zoran <zoran@infoklub.net>
  * Zoran <zoran@infoklub.net>
    | updated Serbian translation
    | updated Serbian translation
+ * Teemu Koskinen
+   | patch to speed up karma parsing
 
 
 I probably forgot a lot of people here, _PLEASE_ notify me if I left you
 I probably forgot a lot of people here, _PLEASE_ notify me if I left you
 out.. because I have a bad habit of forgetting to maintain this list :)
 out.. because I have a bad habit of forgetting to maintain this list :)

+ 1 - 0
docs/Changelog

@@ -14,6 +14,7 @@ pisg (0.69) - ??
    * Bug fixes:
    * Bug fixes:
      + Fix ActiveNicks2 display when ActiveNicks is not divisible by 5
      + Fix ActiveNicks2 display when ActiveNicks is not divisible by 5
        (thanks to Ian Rutson).
        (thanks to Ian Rutson).
+     + Add patch by Teemu Koskinen to speed up karma parsing (SF #1489060).
    * Parsers:
    * Parsers:
      + Finally add miau parser by Kresten Kjeldgaard.
      + Finally add miau parser by Kresten Kjeldgaard.
    Torbjörn:
    Torbjörn:

+ 2 - 2
modules/Pisg/Parser/Logfile.pm

@@ -414,11 +414,11 @@ sub _parse_file
                     }
                     }
 
 
                     # require 2 chars (catches C++), nick must not end in [+=-]
                     # require 2 chars (catches C++), nick must not end in [+=-]
-                    if ($saying =~ /^(\S*\w\S*\w\S*(?<![+=-]))(\+\+|==|--)$/o) {
+                    if ($saying =~ /^(\S+[^\s+=-])(\+\+|==|--)$/) {
                         my $thing = lc $1;
                         my $thing = lc $1;
                         my $k = $2 eq "++" ? 1 : ($2 eq "==" ? 0 : -1);
                         my $k = $2 eq "++" ? 1 : ($2 eq "==" ? 0 : -1);
                         $stats->{karma}{$thing}{$nick} = $k
                         $stats->{karma}{$thing}{$nick} = $k
-                            if !is_ignored($thing) and $thing ne lc($nick);
+                            if $thing =~ /\w\W*?\w/ and !is_ignored($thing) and $thing ne lc($nick);
                     }
                     }
 
 
                     # Find URLs
                     # Find URLs