Daniel Quinlan wrote: > Matthew Cline writes: > > >>I can't find '$&' in any of the Net::DNS version 1.14 files. Was it present >>before this version, or added after it? Maybe we could include a special >>version of Net:DNS without the $& to make SA faster. > It's still there (as $' , actually). Hang on, let me find our (slightly outdated) patch that we sent to the author (and was ignored)...
Hmm... I can't find it. Oh well--I've just made a patch between our custom version and the current version, and I've attached the relevent section. Net::DNS is actually being maintained again now I think, so if someone feels like submitting this to the author again maybe something will happen this time. > > As nearly as I can tell these are the perl modules on my system that are > used by SA and include $&, $', or $`. > <...> You may find Devel::FindAmpersand and friends useful. > > I wish the perlre manual page was more specific about the exact behavior > of the performance penalty. > It's hard to be specific. We found that after a certain number of re's, suddenly every re would slow down by around 1000x (yes, that 1000x, not 1000% !) HTH, Jeremy PS: Is there a list for discussion of the computational side of SA, such as the details of the GA, use of alternate predictive algorithms, etc? Is there much active development in this area or is this part of the problem largely considered solved? I guess I'm particularly wondering about the use of non-parametric models (like MBR, radial basis neural nets, etc) and also the use of boosting. Is it believed that there is much potential upside from better algorithms, or is the main game in creating better rules?
@@ -198,31 +156,28 @@ my ($class, $rrstring, $update_type) = @_; my ($s, %self, $retval); - my $name = undef; + my $name = ""; my $ttl = 0; my $rrclass = ""; my $rrtype = ""; my $rdata = ""; - while ($rrstring =~ /\s*(\S+)\s*/g) { - $s = $1; + my @matches = $rrstring =~ /\s*(\S+)\s*/g; + while (defined($s = shift @matches)) { - if (!defined($name)) { - #($name = $s) =~ s/\.+$//; - $name = $s; - $name =~ s/^\.+//; - $name =~ s/\.+$//; + if (!$name) { + ($name = $s) =~ s/\.+$//; } elsif ($s =~ /^\d+$/) { $ttl = $s; } elsif (!$rrclass && exists $Net::DNS::classesbyname{uc($s)}) { - $rrclass = uc($s); - $rdata = $'; # in case this is really type=ANY + $rrclass = $s; + $rdata = join(' ', @matches); # in case this is really +type=ANY } elsif (exists $Net::DNS::typesbyname{uc($s)}) { - $rrtype = uc($s); - $rdata = $'; + $rrtype = $s; + $rdata = join(' ', @matches); last; } else {