Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил

Запропоновано підхід підвищення продуктивності коду, написаного мовою Python, шляхом перетворення фрагментів коду до більш ефективних мов Cython та C++. Використано високорівневі алгебраїчні моделі та техніку переписувальних правил для автоматизації перетворень програмного коду. Проведено порівняння...

Full description

Saved in:
Bibliographic Details
Published in:Проблеми програмування
Date:2020
Main Author: Жереб, К.А.
Format: Article
Language:Ukrainian
Published: Інститут програмних систем НАН України 2020
Subjects:
Online Access:https://nasplib.isofts.kiev.ua/handle/123456789/180457
Tags: Add Tag
No Tags, Be the first to tag this record!
Journal Title:Digital Library of Periodicals of National Academy of Sciences of Ukraine
Cite this:Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил / К.А. Жереб // Проблеми програмування. — 2020. — № 2-3. — С. 115-125. — Бібліогр.: 13 назв. — укр.

Institution

Digital Library of Periodicals of National Academy of Sciences of Ukraine
id nasplib_isofts_kiev_ua-123456789-180457
record_format dspace
spelling Жереб, К.А.
2021-09-29T15:43:16Z
2021-09-29T15:43:16Z
2020
Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил / К.А. Жереб // Проблеми програмування. — 2020. — № 2-3. — С. 115-125. — Бібліогр.: 13 назв. — укр.
1727-4907
DOI: https://doi.org/10.15407/pp2020.02-03.115
https://nasplib.isofts.kiev.ua/handle/123456789/180457
004.4'24
Запропоновано підхід підвищення продуктивності коду, написаного мовою Python, шляхом перетворення фрагментів коду до більш ефективних мов Cython та C++. Використано високорівневі алгебраїчні моделі та техніку переписувальних правил для автоматизації перетворень програмного коду. Проведено порівняння часу виконання простих програм – початкової версії мовою Python, різних версій перетвореного коду, а також автоматичних засобів Cython та PyPy, що демонструє ефективність запропонованого підходу.
Предложен подход повышения производительности кода, написанного на языке Python, с помощью преобразования фрагментов кода в более эффективные языки Cython и C ++. Использованы высокоуровневые алгебраические модели и техника переписывающих правил для автоматизации преобразований кода. Проведено сравнение времени выполнения простых программ – начальной версии на языке Python, различных версий преобразованного кода, а также автоматических средств Cython и PyPy, что демонстрирует эффективность предложенного подхода.
Python is a popular programming language used in many areas, but its performance is significantly lower than many compiled languages. We propose an approach to increasing performance of Python code by transforming fragments of code to more efficient languages such as Cython and C++. We use high-level algebraic models and rewriting rules technique for semi-automated code transformation. Performance-critical fragments of code are transformed into a low-level syntax model using Python parser. Then this low-level model is further transformed into a high-level algebraic model that is language-independent and easier to work with. The transformation is automated using rewriting rules implemented in Termware system. We also improve the constructed high-level model by deducing additional information such as data types and constraints. From this enhanced high-level model of code we generate equivalent fragments of code using code generators for Cython and C++ languages. Cython code is seamlessly integrated with Python code, and for C++ code we generate a small utility file in Cython that also integrates this code with Python. This way, the bulk of program code can stay in Python and benefit from its facilities, but performance-critical fragments of code are transformed into more efficient equivalents, improving the performance of resulting program. Comparison of execution times between initial version of Python code, different versions of transformed code and using automatic tools such as Cython compiler and PyPy demonstrates the benefits of our approach – we have achieved performance gains of over 50x compared to the initial version written in Python, and over 2x compared to the best automatic tool we have tested.
uk
Інститут програмних систем НАН України
Проблеми програмування
Паралельне програмування. Розподілені системи і мережі
Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил
Повышение производительности кода на языке РYТНОN с использованием техники переписывающих правил
Improving performance of Python code using rewriting rules technique
Article
published earlier
institution Digital Library of Periodicals of National Academy of Sciences of Ukraine
collection DSpace DC
title Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил
spellingShingle Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил
Жереб, К.А.
Паралельне програмування. Розподілені системи і мережі
title_short Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил
title_full Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил
title_fullStr Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил
title_full_unstemmed Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил
title_sort підвищення продуктивності коду мовою рyтноn з використанням техніки переписувальних правил
author Жереб, К.А.
author_facet Жереб, К.А.
topic Паралельне програмування. Розподілені системи і мережі
topic_facet Паралельне програмування. Розподілені системи і мережі
publishDate 2020
language Ukrainian
container_title Проблеми програмування
publisher Інститут програмних систем НАН України
format Article
title_alt Повышение производительности кода на языке РYТНОN с использованием техники переписывающих правил
Improving performance of Python code using rewriting rules technique
description Запропоновано підхід підвищення продуктивності коду, написаного мовою Python, шляхом перетворення фрагментів коду до більш ефективних мов Cython та C++. Використано високорівневі алгебраїчні моделі та техніку переписувальних правил для автоматизації перетворень програмного коду. Проведено порівняння часу виконання простих програм – початкової версії мовою Python, різних версій перетвореного коду, а також автоматичних засобів Cython та PyPy, що демонструє ефективність запропонованого підходу. Предложен подход повышения производительности кода, написанного на языке Python, с помощью преобразования фрагментов кода в более эффективные языки Cython и C ++. Использованы высокоуровневые алгебраические модели и техника переписывающих правил для автоматизации преобразований кода. Проведено сравнение времени выполнения простых программ – начальной версии на языке Python, различных версий преобразованного кода, а также автоматических средств Cython и PyPy, что демонстрирует эффективность предложенного подхода. Python is a popular programming language used in many areas, but its performance is significantly lower than many compiled languages. We propose an approach to increasing performance of Python code by transforming fragments of code to more efficient languages such as Cython and C++. We use high-level algebraic models and rewriting rules technique for semi-automated code transformation. Performance-critical fragments of code are transformed into a low-level syntax model using Python parser. Then this low-level model is further transformed into a high-level algebraic model that is language-independent and easier to work with. The transformation is automated using rewriting rules implemented in Termware system. We also improve the constructed high-level model by deducing additional information such as data types and constraints. From this enhanced high-level model of code we generate equivalent fragments of code using code generators for Cython and C++ languages. Cython code is seamlessly integrated with Python code, and for C++ code we generate a small utility file in Cython that also integrates this code with Python. This way, the bulk of program code can stay in Python and benefit from its facilities, but performance-critical fragments of code are transformed into more efficient equivalents, improving the performance of resulting program. Comparison of execution times between initial version of Python code, different versions of transformed code and using automatic tools such as Cython compiler and PyPy demonstrates the benefits of our approach – we have achieved performance gains of over 50x compared to the initial version written in Python, and over 2x compared to the best automatic tool we have tested.
issn 1727-4907
url https://nasplib.isofts.kiev.ua/handle/123456789/180457
citation_txt Підвищення продуктивності коду мовою РYТНОN з використанням техніки переписувальних правил / К.А. Жереб // Проблеми програмування. — 2020. — № 2-3. — С. 115-125. — Бібліогр.: 13 назв. — укр.
work_keys_str_mv AT žerebka pídviŝennâproduktivnostíkodumovoûrytnonzvikoristannâmtehníkiperepisuvalʹnihpravil
AT žerebka povyšenieproizvoditelʹnostikodanaâzykerytnonsispolʹzovaniemtehnikiperepisyvaûŝihpravil
AT žerebka improvingperformanceofpythoncodeusingrewritingrulestechnique
first_indexed 2025-12-07T18:33:52Z
last_indexed 2025-12-07T18:33:52Z
_version_ 1850875505997250560