speice.io/assets/js/dca2e11d.209b089a.js

1 line
3.1 KiB
JavaScript

"use strict";(self.webpackChunkspeice_io=self.webpackChunkspeice_io||[]).push([["6424"],{5347:function(e,t,n){n.r(t),n.d(t,{assets:function(){return l},contentTitle:function(){return s},default:function(){return h},frontMatter:function(){return o},metadata:function(){return r},toc:function(){return c}});var r=n(6160),i=n(5893),a=n(65);let o={slug:"2019/12/release-the-gil",title:"Release the GIL",date:new Date("2019-12-14T12:00:00.000Z"),authors:["bspeice"],tags:[]},s=void 0,l={authorsImageUrls:[void 0]},c=[];function u(e){let t={a:"a",em:"em",p:"p",...(0,a.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["Complaining about the ",(0,i.jsx)(t.a,{href:"https://wiki.python.org/moin/GlobalInterpreterLock",children:"Global Interpreter Lock"}),"\n(GIL) seems like a rite of passage for Python developers. It's easy to criticize a design decision\nmade before multi-core CPU's were widely available, but the fact that it's still around indicates\nthat it generally works ",(0,i.jsx)(t.a,{href:"https://wiki.c2.com/?PrematureOptimization",children:"Good"}),"\n",(0,i.jsx)(t.a,{href:"https://wiki.c2.com/?YouArentGonnaNeedIt",children:"Enough"}),". Besides, there are simple and effective\nworkarounds; it's not hard to start a\n",(0,i.jsx)(t.a,{href:"https://docs.python.org/3/library/multiprocessing.html",children:"new process"})," and use message passing to\nsynchronize code running in parallel."]}),"\n",(0,i.jsxs)(t.p,{children:["Still, wouldn't it be nice to have more than a single active interpreter thread? In an age of\nasynchronicity and ",(0,i.jsx)(t.em,{children:"M:N"})," threading, Python seems lacking. The ideal scenario is to take advantage of\nboth Python's productivity and the modern CPU's parallel capabilities."]})]})}function h(e={}){let{wrapper:t}={...(0,a.a)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(u,{...e})}):u(e)}},65:function(e,t,n){n.d(t,{Z:function(){return s},a:function(){return o}});var r=n(7294);let i={},a=r.createContext(i);function o(e){let t=r.useContext(a);return r.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(a.Provider,{value:t},e.children)}},6160:function(e){e.exports=JSON.parse('{"permalink":"/2019/12/release-the-gil","source":"@site/blog/2019-12-14-release-the-gil/index.mdx","title":"Release the GIL","description":"Complaining about the Global Interpreter Lock","date":"2019-12-14T12:00:00.000Z","tags":[],"readingTime":8.58,"hasTruncateMarker":true,"authors":[{"name":"Bradlee Speice","socials":{"github":"https://github.com/bspeice"},"key":"bspeice","page":null}],"frontMatter":{"slug":"2019/12/release-the-gil","title":"Release the GIL","date":"2019-12-14T12:00:00.000Z","authors":["bspeice"],"tags":[]},"unlisted":false,"lastUpdatedAt":1731207983000,"prevItem":{"title":"The webpack industrial complex","permalink":"/2011/11/webpack-industrial-complex"},"nextItem":{"title":"Binary format shootout","permalink":"/2019/09/binary-format-shootout"}}')}}]);