Re: optimizing a program that just shuffles data, a bit like cat...

2005-09-23 Thread Oracle
On Fri, 23 Sep 2005 01:16:46 +, Dan Stromberg wrote:

> 
> ...but with much bigger blocksizes, and with a netcat-like ability to use
> sockets.
> 

Try using psyco and see if that helps.  Also, sometimes smaller blocks are
better than large blocks.  Try using smaller block sizes and see if that
helps.

If you're worried about the time required to calculate the length of your
block, try calculating it once and pass the length around.  Is that doable?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32 service and time.sleep()

2005-09-20 Thread Oracle
On Tue, 20 Sep 2005 10:49:13 -0400, rbt wrote:

> I have a win32 service written in Python. It works well. It sends a
> report of the status of the machine via email periodically. The one
> problem I have is this... while trying to send an email, the script
> loops until a send happens and then it breaks. Should it be unable to
> send, it sleeps for 10 minutes with time.sleep(600) and then wakes and
> tries again. This is when the problem occurs. I can't stop the service
> while the program is sleeping. When I try, it just hangs until a reboot.
> Can some suggest how to fix this?
> 

You could try doing it the hard way.  In a loop, sleep for 1-5 seconds at
a time.  Everytime you complete a sleep, check the elapsed time.  If the
elapsed time is >= the total sleep duration, fall out of the sleep loop
and try your email again.  This should allow your service to stop within
1-5 seconds of your request while imposing little to no load on the system.



-- 
http://mail.python.org/mailman/listinfo/python-list