{"id":227037,"date":"2020-12-01T05:23:57","date_gmt":"2020-11-30T21:23:57","guid":{"rendered":"http:\/\/4563.org\/?p=227037"},"modified":"2020-12-01T05:23:57","modified_gmt":"2020-11-30T21:23:57","slug":"memoryview-%e7%9a%84%e4%bd%bf%e7%94%a8%e5%9c%ba%e6%99%af%e5%88%b0%e5%ba%95%e6%98%af%e4%bb%80%e4%b9%88%e5%91%a2%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=227037","title":{"rendered":"memoryview \u7684\u4f7f\u7528\u573a\u666f\u5230\u5e95\u662f\u4ec0\u4e48\u5462\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  memoryview \u7684\u4f7f\u7528\u573a\u666f\u5230\u5e95\u662f\u4ec0\u4e48\u5462\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaolinjia <\/span>  <span><i><\/i> 14<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6211\u4e00\u76f4\u60f3\u77e5\u9053 py \u7684 memoryview \u80fd\u5e72\u561b\uff0c\u4f46\u6211\u5e73\u65f6\u770b\u7684\u4e00\u4e9b\u6280\u672f\u4e66\u548c\u535a\u5ba2\uff0c\u5fae\u4fe1\u516c\u4f17\u53f7\u90fd\u9c9c\u6709\u63d0\u53ca\u5230\u8fd9\u5757\uff0c\u6211\u5e73\u65f6\u5199\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u4e5f\u6ca1\u9047\u5230\u8981\u4f7f\u7528\u5b83\u7684\u573a\u666f\u3002\u6211\u4e5f\u67e5\u4e86\u4e0b\uff0cmemoryview \u662f\u6709\u5b66\u4e60\u4e86 numpy \u7684\u601d\u60f3\uff0c\u5f04\u51fa\u6765\u7684\u6570\u636e\u7ed3\u6784\uff0c\u597d\u50cf\u662f\u7528\u6765\u5171\u4eab\u5185\u5b58\u4e0d\u7528\u8fdb\u884c\u590d\u5236\u64cd\u4f5c\uff1f\u6240\u4ee5 memoryview \u6709\u4ec0\u4e48\u6bd4\u8f83\u5e38\u7528\u7684\u573a\u666f\u5417\u3002      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4485160\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wuwukai007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5927\u77e9\u9635\u8ba1\u7b97\uff0c\u77e9\u9635\u7528\u4e00\u4e2a\uff0c\u4f46\u662f\u7b97\u6cd5\u4e0d\u4e00\u6837\uff0c\u5f00\u591a\u8fdb\u7a0b\u5171\u4eab\u77e9\u9635\u5185\u5b58\uff0c\u5c31\u4e0d\u9700\u8981\u6bcf\u4e2a\u8fdb\u7a0b\u590d\u5236\u4e00\u4e2a\u5927\u77e9\u9635\u4e86\uff0c\u6548\u7387\u9ad8\uff0c\u8282\u7701\u5185\u5b58                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485161\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : guyskk0x0 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             http server, socket \u76f8\u5173\u573a\u666f\u6709\u7528\u5230\uff0c\u53ef\u4ee5\u907f\u514d\u590d\u5236\u5185\u5b58\uff0c\u5b9e\u73b0 zero copy \u6548\u679c\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485162\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bilibilifi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             cython \u91cc\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u66b4\u9732\u63a5\u53e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485163\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mattx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @bilibilifi \u95ee\u4e0b \u5728 cython \u7684\u573a\u666f\u662f\u600e\u4e48\u6837\u7684\uff0c\u8d34\u4e2a\u4ee3\u7801\u770b\u770b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485164\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ruanimal <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             zero copy                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485165\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiaolinjia <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @guyskk0x0 <br \/>@ruanimal <br \/>\u4e24\u4f4d\u90fd\u63d0\u5230\u4e86\u96f6\u62f7\u8d1d\u7684\u573a\u666f\uff0c\u4f46\u662f py \u4e0d\u662f\u6709 mmap \u8fd9\u4e2a\u6a21\u5757\u4e5f\u63d0\u4f9b\u4e86\u8fd9\u4e2a\u5417\uff1f\u8fd9\u4e2a\u548c mmap \u7684\u6709\u5565\u4e0d\u540c\u5462\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485166\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ruanimal <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xiaolinjia <\/p>\n<p>mmap \u662f\u5171\u4eab\u5185\u5b58\u3002 <br \/>zero copy \u662f\u4e3a\u4e86\u907f\u514d\u91cd\u590d copy \u5bf9\u8c61\uff0c\u6bd4\u5982 socket \u53d1\u5305\u7684\u65f6\u5019\uff0c\u907f\u514d\u5728\u591a\u4e2a\u7f13\u51b2\u533a\u4e4b\u95f4\u53cd\u590d copy \u5185\u5b58\u3002zero copy \u5728 linux \u4e0b\u662f\u57fa\u4e8e sendfile \u5b9e\u73b0\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485167\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiaolinjia <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @wuwukai007 \u4f60\u6307\u7684\u662f multiprocessing.Process(target=func1, args=memoryview(sth))\u3001multiprocessing.Process(target=func2, args=memoryview(sth))\u5417\uff0c\u8fd8\u662f\u7279\u6307 py38 \u7684 multiprocess.SharedMemory \u3002\u6211\u770b\u4e86\u4e0b SharedMemory \u7684\u6e90\u7801\uff0c\u786e\u5b9e\u662f\u6709\u7528\u5230 memoryview \u548c mmap \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4485168\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wuwukai007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             python3.8 \u7684\u65b0\u7279\u6027                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>memoryview \u7684\u4f7f\u7528\u573a\u666f\u5230&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/227037"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=227037"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/227037\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227037"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}