On Sunday 30 July 2006 15:42, David Sowder (Zothar) wrote:

> Perhaps it's a lot more work and harder to do, but I think it would
> be much better to fix the corner cases with the Hashmaps used by
> node.getPeerNodeStatusSize() rather than calculating it for every
> /darknet/ page load.  Part of the idea of
> node.getPeerNodeStatusSize() was for the information to be both
> accurate and available to other parts of the node at near zero CPU
> cost.

Uhm, I'm not sure I completely understand what you mean but iterating 
once (!) over an array of 5 to 50 PeerNode objects and calling a method 
that simply returns an int (which most probably gets inlined anyway) is 
something I do consider "near zero CPU cost."

The problem with node.getPeerNodeStatusSize() is that state information 
for a PeerNode can change during the point getPeerNodeStatusSize() is 
called and the PeerNode's status itself is shown on the page. To fix 
that you'd either have to synchronized Node externally (which is a 
_very_ bad idea) or you'd have to return a list of shallow PeerNode 
copies that don't change their state after returning them.


        David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20060801/7ac9cc6f/attachment.pgp>

Reply via email to