{"id":112509,"date":"2023-12-26T15:10:22","date_gmt":"2023-12-26T13:10:22","guid":{"rendered":"https:\/\/prohoster.info\/blog\/novosti-interneta\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch"},"modified":"2023-12-26T15:10:22","modified_gmt":"2023-12-26T13:10:22","slug":"dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch","status":"publish","type":"post","link":"https:\/\/prohoster.info\/es\/blog\/news\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch","title":{"rendered":"Se ha propuesto un compilador JIT para Python que utiliza la t\u00e9cnica copy-and-patch","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Brandt Bucher de Microsoft, uno de los desarrolladores principales de CPython, que trabaja en el equipo que se ocupa de mejorar el rendimiento del int\u00e9rprete de CPython, ha publicado una implementaci\u00f3n de un compilador JIT para Python, utilizando la t\u00e9cnica Copy-and-Patch. La publicaci\u00f3n del JIT coincide con la Navidad y el anuncio est\u00e1 escrito en verso.     <\/p>\n<p>El JIT propuesto se destaca por su alta velocidad de generaci\u00f3n de c\u00f3digo, su facilidad de mantenimiento y su integraci\u00f3n completa con el int\u00e9rprete. El m\u00e9todo propuesto permite transformar autom\u00e1ticamente el int\u00e9rprete, escrito en C, en un compilador JIT, sin la necesidad de desarrollar separadamente la l\u00f3gica de generaci\u00f3n de c\u00f3digo ni de crear manualmente representaciones en ensamblador. Con este enfoque, al corregir un error en el int\u00e9rprete, se solucionar\u00e1 autom\u00e1ticamente el mismo problema en el JIT, ya que se utiliza un generador de c\u00f3digo compartido.    <\/p>\n<p>El funcionamiento del m\u00e9todo Copy-and-Patch se basa en que la reubicaci\u00f3n de c\u00f3digo en memoria al cargar archivos objeto mediante un enlazador y la sustituci\u00f3n de instrucciones de m\u00e1quina en lugar de bytecode en el JIT son problemas similares. Al ejecutar el JIT, se recorren las instrucciones de bytecode generadas por el int\u00e9rprete y se copia, para cada instrucci\u00f3n, el c\u00f3digo de m\u00e1quina precompilado en la regi\u00f3n de memoria con el c\u00f3digo ejecutable, adem\u00e1s de modificar sobre la marcha las instrucciones para insertar los datos procesados (el JIT copia plantillas precompiladas y las rellena con valores necesarios, como argumentos y constantes). Tambi\u00e9n se realiza la copia del c\u00f3digo de m\u00e1quina en memoria y la sustituci\u00f3n de s\u00edmbolos externos al cargar archivos objeto.    <\/p>\n<p>En el JIT Copy-and-Patch, se utiliza LLVM para compilar un archivo objeto en formato ELF, que contiene datos sobre las instrucciones de bytecode y la informaci\u00f3n sobre reemplazos de datos necesarios. El JIT reemplaza las instrucciones de bytecode generadas durante la interpretaci\u00f3n del programa por representaciones en c\u00f3digo de m\u00e1quina, insertando al mismo tiempo los datos necesarios para los c\u00e1lculos. La implementaci\u00f3n del JIT requiere como dependencia LLVM en la etapa de compilaci\u00f3n, pero los componentes en tiempo de ejecuci\u00f3n no dependen de dependencias externas y se reducen aproximadamente a 300 l\u00edneas de c\u00f3digo escritas manualmente en C y 3000 l\u00edneas de c\u00f3digo generado en C.        <\/p>\n<p>En comparaci\u00f3n con las herramientas JIT tradicionales (LLVM -O0), el JIT propuesto ofrece una generaci\u00f3n de c\u00f3digo 100 veces m\u00e1s r\u00e1pida y un c\u00f3digo resultante un 15% m\u00e1s r\u00e1pido. En comparaci\u00f3n con la compilaci\u00f3n a WebAssembly (Liftoff), el nuevo JIT genera c\u00f3digo 5 veces m\u00e1s r\u00e1pido, mientras que el c\u00f3digo resultante funciona un 50% m\u00e1s r\u00e1pido. Comparando el nuevo JIT con el JIT optimizador (LuaJIT), que utiliza c\u00f3digo ensamblador escrito manualmente, la opci\u00f3n propuesta fue m\u00e1s r\u00e1pida en 13 de 44 pruebas, aunque en promedio estuvo un 35% por detr\u00e1s en rendimiento, a pesar de simplificar significativamente el mantenimiento y reducir la complejidad de la implementaci\u00f3n.            <center>  <div class=\"youtube-placeholder\" data-id=\"HxSHIpEQRjs\" onclick=\"loadVideo(this)\">\r\n        <img decoding=\"async\" src=\"https:\/\/img.youtube.com\/vi\/HxSHIpEQRjs\/hqdefault.jpg\" alt=\"Reproducir video\" loading=\"lazy\" width=\"480\" height=\"360\" style=\"width:100%;height:auto;\">\r\n        <div class=\"play-button\"><\/div>\r\n    <\/div><\/center><br \/>\n<br \/>Fuente: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/www.opennet.ru\/opennews\/art.shtml?num=60352\">opennet.ru<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0411\u0440\u0430\u043d\u0434\u0442 \u0411\u0443\u043a\u0435\u0440 (Brandt Bucher) \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Microsoft, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432 \u0447\u0438\u0441\u043b\u043e core-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 CPython \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 CPython, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0434\u043b\u044f Python, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0443\u044e \u0442\u0435\u0445\u043d\u0438\u043a\u0443 Copy-and-Patch. \u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f JIT \u043f\u0440\u0438\u0443\u0440\u043e\u0447\u0435\u043d\u0430 \u043a \u0420\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u0443 \u0438 \u0430\u043d\u043e\u043d\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u0441\u0442\u0438\u0445\u0430\u0445. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 JIT \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u0435\u043d \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u043e\u0439 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0441 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u043c. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[702],"tags":[],"class_list":["post-112509","post","type-post","status-publish","format-standard","hentry","category-news"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0411\u0440\u0430\u043d\u0434\u0442 \u0411\u0443\u043a\u0435\u0440 (Brandt Bucher) \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Microsoft, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432 \u0447\u0438\u0441\u043b\u043e core-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 CPython \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 CPython, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/es\/blog\/news\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"es_ES\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0414\u043b\u044f Python \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u0445\u043d\u0438\u043a\u0443 copy-and-patch | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0411\u0440\u0430\u043d\u0434\u0442 \u0411\u0443\u043a\u0435\u0440 (Brandt Bucher) \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Microsoft, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432 \u0447\u0438\u0441\u043b\u043e core-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 CPython \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 CPython, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/es\/blog\/news\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2023-12-26T13:10:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2023-12-26T13:10:22+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Se ha propuesto un compilador JIT para Python que utiliza la t\u00e9cnica copy-and-patch | ProHoster","description":"Brandt Bucher de Microsoft, miembro del equipo principal de desarrolladores de CPython y parte del equipo que trabaja en aumentar la eficiencia del int\u00e9rprete de CPython, public\u00f3 una implementaci\u00f3n.","canonical_url":"https:\/\/prohoster.info\/es\/blog\/news\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"es_ES","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0414\u043b\u044f Python \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u0445\u043d\u0438\u043a\u0443 copy-and-patch | ProHoster","og:description":"\u0411\u0440\u0430\u043d\u0434\u0442 \u0411\u0443\u043a\u0435\u0440 (Brandt Bucher) \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Microsoft, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432 \u0447\u0438\u0441\u043b\u043e core-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 CPython \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 CPython, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.","og:url":"https:\/\/prohoster.info\/es\/blog\/news\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2023-12-26T13:10:22+00:00","article:modified_time":"2023-12-26T13:10:22+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":[],"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/posts\/112509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/comments?post=112509"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/posts\/112509\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/media?parent=112509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/categories?post=112509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/tags?post=112509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}