Exemplo n.º 1
0
 def get_destination(self, address):
     if isinstance(address, Message):
         address = address.getheader("DEST")
     if isinstance(address, str):
         address = Address.fromurl(address)
     host = self.gethost(address.hostname())
     return host.getchannel(address.name())
Exemplo n.º 2
0
 def get_destination(self, address):
     if isinstance(address, Message):
         address = address.getheader("DEST")
     if isinstance(address, str):
         address = Address.fromurl(address)
     host = self.gethost(address.hostname())
     return host.getchannel(address.name())
Exemplo n.º 3
0
this file and link it with other works to produce a work based         
on this file, this file does not by itself cause the resulting         
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
import time
from mpx.lib.messaging.tools import Address

tstart = time.time()
for i in xrange(1000):
    address = Address.fromurl(url)
    name = address.name()
    hostname = address.hostname()


tstop = time.time()
print "Took %0.3f seconds to parse %d URLs" % (tstop - tstart, i)
# Took 1.174 seconds to parse 999 URLs


import time
from Queue import Queue
Thing = object()

queue = Queue()
tstart = time.time()
Exemplo n.º 4
0
this file and link it with other works to produce a work based         
on this file, this file does not by itself cause the resulting         
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
import time
from mpx.lib.messaging.tools import Address

tstart = time.time()
for i in xrange(1000):
    address = Address.fromurl(url)
    name = address.name()
    hostname = address.hostname()

tstop = time.time()
print "Took %0.3f seconds to parse %d URLs" % (tstop - tstart, i)
# Took 1.174 seconds to parse 999 URLs

import time
from Queue import Queue
Thing = object()

queue = Queue()
tstart = time.time()
for i in xrange(1000):
    queue.put(Thing)