<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Buffer-Protocol on Shai Asher</title><link>https://slow-is-smooth.io/tags/buffer-protocol/</link><description>Recent content in Buffer-Protocol on Shai Asher</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 20 Oct 2019 09:00:00 +0300</lastBuildDate><atom:link href="https://slow-is-smooth.io/tags/buffer-protocol/index.xml" rel="self" type="application/rss+xml"/><item><title>Sharing Memory with C</title><link>https://slow-is-smooth.io/blog/sharing-memory-with-c/</link><pubDate>Sun, 20 Oct 2019 09:00:00 +0300</pubDate><guid>https://slow-is-smooth.io/blog/sharing-memory-with-c/</guid><description>&lt;p&gt;Python 3.8, released last week, adds a pickle protocol that can serialise a 100 MB NumPy array into&#10;122 bytes. The other 100,000,000 bytes aren&amp;rsquo;t copied into the pickle at all. They&amp;rsquo;re handed to the&#10;caller as a buffer, the array&amp;rsquo;s own memory, to send however it likes. That works because of an&#10;interface that has been in Python 3 from the start and that most Python programmers never see: the&#10;buffer protocol, through which one object lends the raw memory behind it to another, with no copy, as&#10;long as the lender agrees to keep it still.&lt;/p&gt;</description></item></channel></rss>