Alan,

Ironically, I was working on the code today.  Attached is an alternative for
consideration.

I had an InetNetwork class for dealing with netmasks, but I didn't have
methods to convert from the CIDR or asterisk formats.  When I benchmarked
the netmasking code, the performance difference was roughly in excess of
20:1, so I decided to look at adding conversion methods.  Attached is a test
driver with both sets of code and test data.  On my system, InetNetwork
performance is from 30 - 50 times faster than CIDR for the same behavior.

Some functional differences:

 1. /0 is handled differently.
    - InetNetwork handles /0 as allowing all.
    - CIDR appears to use /0 as reject all.

 2. InetNetwork allows arbitrary IP/bits; CIDR doesn't.

 3. InetNetwork allows domain names as well as IP addresses.

 4. CIDR, in the code intended for the matcher, discards 127.0.0.1
    in favor of a locally bound IP address.  This causes a spurious
    difference where InetNetwork appears to be 400+ times faster than CIDR.

 5. InetNetwork allows IP/MASK, which is actually its "native" format.

 6. CIDR does more error checking during initialization than InetNetwork
    at present.  Initialization time is not factored into the tests.

Feedback appreciated.

        --- Noel

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 15, 2003 22:41
To: James Developers List
Subject: CIDR Code Assesments


Thanks Noel for the review of the CIDR code that was
submitted
(http://www.mail-archive.com/[email protected]/msg06695.html)
..

Your modifications are excellent - tighter and cleaner
code.

After spending a little more time with
live-testing, I have only found a problem with the
GeneriocNetworkMatcher:init(); the order in which the check
for localhost, explicit address, wildcard match was wrong.
The check for wildcard match needs to be before the explicit
address check.

I've made this correction and added a bit to the
documentation.

Currently this code is in use at a commercial ISP and is
differentiating between ~200 distinct networks.

Please accept the attached Networks.Zip for inclusion in the
next regular release of James.

(when you guys get a chance to breathe of course!!)



_______________________
Alan Gerhard
Gerhard Computing, Inc.
1-860-355-8610
1-860-355-9041
[EMAIL PROTECTED]

Attachment: NetTest.zip
Description: Zip compressed data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to