{"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\/it\/blog\/news\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch","title":{"rendered":"Per Python \u00e8 stato proposto un compilatore JIT che utilizza la tecnica copy-and-patch","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Brandt Bucher di Microsoft, uno dei core developer di CPython e membro del team che si occupa di migliorare le prestazioni dell'interprete CPython, ha pubblicato un'implementazione del compilatore JIT per Python che utilizza la tecnica Copy-and-Patch. La pubblicazione del JIT \u00e8 stata programmata in occasione del Natale e l'annuncio \u00e8 scritto in versi.     <\/p>\n<p>Il JIT proposto si distingue per l'alta velocit\u00e0 di generazione del codice, la semplicit\u00e0 di manutenzione e la completa integrazione con l'interprete. Il metodo proposto consente di trasformare automaticamente un interprete scritto in linguaggio C in un compilatore JIT, senza la necessit\u00e0 di formare separatamente la logica di generazione del codice e senza creare manualmente rappresentazioni in assembly. Con questo approccio, la correzione di un errore nell'interprete porter\u00e0 automaticamente alla risoluzione dello stesso problema nel JIT, poich\u00e9 viene utilizzato un generatore di codice comune.    <\/p>\n<p>Il funzionamento del metodo Copy-and-Patch si basa sul fatto che la riallocazione del codice in memoria durante il caricamento da parte del linker dei file oggetto e la sostituzione delle istruzioni macchina al posto del bytecode nel JIT sono compiti simili. Durante l'esecuzione del programma, il JIT esegue un'analisi delle istruzioni bytecode create dall'interprete e copia per ciascuna istruzione il codice macchina precaricato nell'area di memoria con codice eseguibile, modificando al contempo le istruzioni in tempo reale per inserire i dati in elaborazione (il JIT copia modelli gi\u00e0 compilati di funzioni e sostituisce i valori necessari, come argomenti e costanti). Durante il caricamento dei file oggetto avviene anche la copia del codice macchina in memoria e la sostituzione dei simboli esterni.    <\/p>\n<p>Nel Copy-and-Patch JIT, tramite LLVM, viene creato un file oggetto in formato ELF, contenente dati sulle istruzioni del bytecode e informazioni sulle necessarie sostituzioni di dati. Il JIT sostituisce le istruzioni del bytecode generate durante l'interpretazione del programma con rappresentazioni in codice macchina, inserendo nel contesto i dati necessari per i calcoli. L'implementazione del JIT richiede LLVM come dipendenza nella fase di build, ma i componenti runtime non sono legati a dipendenze esterne e si riducono a circa 300 righe di codice scritte a mano in C e 3000 righe di codice C generate.        <\/p>\n<p>Rispetto agli strumenti JIT tradizionali (LLVM -O0), il JIT proposto offre una generazione del codice 100 volte pi\u00f9 veloce e un codice risultante pi\u00f9 veloce del 15%. Rispetto alla compilazione in WebAssembly (Liftoff), il nuovo JIT genera codice 5 volte pi\u00f9 velocemente e il codice risultante funziona il 50% pi\u00f9 velocemente. Se confrontiamo il nuovo JIT con il JIT ottimizzante (LuaJIT), che utilizza codice scritto a mano in assembly, la variante proposta si \u00e8 rivelata pi\u00f9 veloce in 13 su 44 test, mentre mediamente ha mostrato prestazioni inferiori del 35%, con un notevole semplificarsi della manutenzione e una riduzione del livello di complessit\u00e0 dell'implementazione.            <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=\"Guarda il 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 \/>Fonte: <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.1.1 - 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\/it\/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.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"it_IT\" \/>\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\/it\/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\udd47Per Python \u00e8 stato proposto un JIT compiler che utilizza la tecnica copy-and-patch | ProHoster","description":"Brandt Bucher di Microsoft, uno dei core developer di CPython e parte del team che si occupa di migliorare le prestazioni dell'interprete CPython, ha pubblicato un'implementazione.","canonical_url":"https:\/\/prohoster.info\/it\/blog\/news\/dlya-python-predlozhen-jit-kompilyator-ispolzuyushhij-tehniku-copy-and-patch","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"it_IT","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\/it\/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\/it\/wp-json\/wp\/v2\/posts\/112509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/comments?post=112509"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts\/112509\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/media?parent=112509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/categories?post=112509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/tags?post=112509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}