[viff-devel] [issue72] Streamline stringReceived

Martin Geisler tracker at viff.dk
Wed Oct 8 06:54:28 PDT 2008


New submission from Martin Geisler <mg at daimi.au.dk>:

The stringReceived method of ShareExchanger starts with

  if self.peer_id is None:
      # Get peer ID.
  else:
      # Handle incoming share.

and it bugs me that we have to do this test every single time we
receive some data from another player!

I have an idea for streamlining this: we could initialize
incoming_data with a Deferred with a program counter of [0] or
something like that and then each player would send its player ID
using that program counter.

This will trigger the Deferred, which will then do what whatever the
first branch of the if-statement does today.

I hope we can gain some performance by having fewer conditional
statements on this critical path.

----------
keyword: design
messages: 264
nosy: mg
status: unread
title: Streamline stringReceived
type: wish

____________________________________
VIFF Issue Tracker <tracker at viff.dk>
<http://tracker.viff.dk/issue72>
____________________________________


More information about the viff-devel mailing list