Popular recipes tagged "python" and "performance"http://code.activestate.com/recipes/tags/python+performance/popular/2014-06-13T13:41:25-07:00ActiveState Code Recipessocket.sendfile() (Python)
2014-06-13T13:41:25-07:00Giampaolo RodolĂ http://code.activestate.com/recipes/users/4178764/http://code.activestate.com/recipes/578889-socketsendfile/
<p style="color: grey">
Python
recipe 578889
by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a>
(<a href="/recipes/tags/backport/">backport</a>, <a href="/recipes/tags/performance/">performance</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sendfile/">sendfile</a>).
Revision 2.
</p>
<p>This is a backport of socket.sendfile() for Python 2.6 and 2.7.
socket.sendfile() will be included in Python 3.5:
<a href="http://bugs.python.org/issue17552" rel="nofollow">http://bugs.python.org/issue17552</a></p>
Generator with lookahead (Python)
2013-09-24T10:44:56-07:00Rutger Saalminkhttp://code.activestate.com/recipes/users/4187940/http://code.activestate.com/recipes/578671-generator-with-lookahead/
<p style="color: grey">
Python
recipe 578671
by <a href="/recipes/users/4187940/">Rutger Saalmink</a>
(<a href="/recipes/tags/background/">background</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/generators/">generators</a>, <a href="/recipes/tags/lookahead/">lookahead</a>, <a href="/recipes/tags/performance/">performance</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>Python generators are a great way of reducing memory usage due to the lazy (on demand) generation of values. However, when the process-time of generating such a value is relatively high, we can improve performance even more by obtaining the next n values of the generator in a separate thread in the background. Hence, the BackgroundGenerator.</p>