> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Dave Hooper
> Sent: den 27 oktober 2003 20:55
> To: [EMAIL PROTECTED]
> Subject: [freenet-dev] Re: [freenet-CVS] 
> freenet/src/freenetOpenConnectionManager.java, 1.147, 1.148
> 
> 
> Could someone please explain this 'lesser optimization' to 
> me? 

Sure, previously we where doing:

Integer count = Hashtable.get();
If(count != null)
        Hashtable.put(new Integer(count.intValue+1));
Else
        Hashtable.put(new Integer(0));

Now we are doing:

myInt count = Hashtable.get();
If(count != null)
        count.intValue++;
Else
        Hashtable.put(new myInt(0));

One less object allocated and one less HashTable lookup if count !=
null, else the same.

The problem that was is that Integer doesn't support the '++' operation
whilst myInt does (by directly exposing its boxed int).

>Is that 'blockedConnections.put' not important?  This 
> change seems to remove it completely. Won't this blow up if
Integer==Null?

I haven't yet seen it blow up but there definitely is a bug in it (I
must have misread the original code somehow). I am working on fixing it
now. I would appreciate if you 'stuck your eyes' on my fix too :)

> Sorry in advance for sticking my eyes in stuff I don't 
> normally follow.

I appreciate that.

/N

_______________________________________________
Devl mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to