From: Lionel B. <lio...@bo...> - 2009-08-20 23:21:28
|
Michal Ludvig a écrit, le 08/21/2009 12:54 AM : > Lionel Bouton wrote: > > >> I discouraged elaborate matchers for a reason : they are slow. >> If you use full IP or class-c, you are looking up a hash entry. If you >> do regex or prefix-based matching, this can become a full sequential >> search on a list and this part of the code is hit on each and every mail >> so it better be fast. >> > > It needn't be slow if done smartly ;-) > > What I have already (mostly) ready for checkin is roughly: > - instead of current $whitelist{IP}{ip} and $whitelist{C}{ip} > have $whitelist{prefixlen}{ip} (and similar for IPv6). > For example the entries would be: > $whitelist{24}{"1.2.3.0"} > $whitelist{24}{"10.20.30.0"} > $whitelist{16}{"123.123.0.0"} > - Then for each incoming IP: > foreach $prefix (sort(keys $whitelist)) { > $masked_ip = apply_prefix($ip, $prefix); > // Whitelist match? > return 1 if (defined $whitelist{$prefix}{$masked_ip}); > } > Hum, I must agree this looks good. The worst theoretical possible case would be 31 apply_prefix calls and hash lookups. > [...] > I vote for SVN ;-) Then you can use git-svn, can't you? I never used it > myself though. > There's no gain in using git-svn if we want to share our developments. A distributed source control system encourages parallel development and would make it far easier to exchange changesets between different branches. I'm git all the way. In fact I'm so used to it know that I was depressed by CVS (centralized systems have lost much of their appeal to me now, but CVS in particular should simply be buried and forgotten) the last times I played with SQLgrey's sources and gave up working with it. Lionel |