Метод динамічних викликів в .NET шляхом генерації вихідного коду на етапі компіляції
| dc.contributor.author | Войтко, В. В. | uk |
| dc.contributor.author | Позур, М. Ю. | uk |
| dc.contributor.author | Voitko, V. | en |
| dc.contributor.author | Pozur, М. | en |
| dc.identifier.orcid | https://orcid.org/0000-0002-3329-7256 | |
| dc.identifier.orcid | https://orcid.org/0009-0003-5225-2453 | |
| dc.title | Метод динамічних викликів в .NET шляхом генерації вихідного коду на етапі компіляції | uk |
| dc.title.alternative | Method of executing dynamic calls in .NET using source code generation | en |
| dc.date.issued | 2025 | |
| dc.publisher | Херсонський національний технічний університет | uk |
| dc.identifier.citation | Войтко В. В., Позур М. Ю. Метод динамічних викликів в .NET шляхом генерації вихідного коду на етапі компіляції // Вісник Херсонського національного технічного університету. 2025. № 2 (93), ч. 2. С. 115-120. DOI: https://doi.org/10.35546/kntu2078-4481.2025.2.2.13. | uk |
| dc.relation.ispartof | Вісник Херсонського національного технічного університету. № 2 (93), ч. 2 : 115-120. | uk |
| dc.relation.uri | https://journals.kntu.kherson.ua/index.php/visnyk_kntu/article/view/1030 | |
| dc.identifier.doi | https://doi.org/10.35546/kntu2078-4481.2025.2.2.13 | |
| dc.identifier.issn | 2078-4481 | |
| dc.identifier.udc | 004.624 | |
| dc.identifier.uri | https://ir.lib.vntu.edu.ua/handle/123456789/54912 | |
| dc.description.abstract | The article discusses the development of a method for executing dynamic calls in .NET by generating code at the compilation. The traditional mechanism for making dynamic calls in .NET, based on the use of reflection, is analyzed. It is determined that the key disadvantage of such an approach is its performance, which necessitates the search for an alternative solution for making dynamic calls. A review of recent publications on the topic of optimizing dynamic calls in .NET is conducted. As a result of the analysis, it is determined that a number of existing solutions describe only the process of making a call, but do not consider the storage of generated functions and a structure that would allow for their reuse. A solution based on the generation of metadata at the compilation stage and the association of such metadata with corresponding static calls is considered. A solution is proposed that is also based on the generation of the metadata during compilation and their association with static calls. The advantage of the proposed solution over the existing one is the ability to make dynamic calls for objects cast to one of the basic types, which expands the list of scenarios for the proposed method’s application. This was achieved by using a metadata structure that is similar to the reflection. Metadata generation is implemented with Incremental Source Generators, which allows for efficient code generation. The method involves using a combination of two code generators, one of which is responsible for generating the metadata itself, and the other for generating code that combines such metadata into a single structure. To determine data types for which generation is required, it is proposed to use both metadata attributes and special methods that accept the data type as an argument. This allowed for the proposed method to be used for data types defined in the context of the current syntax tree and data types belonging to external libraries. The performance of the developed method was tested using the Benchmark.NET library, as a result of which it was found that the proposed method has better performance compared to reflection | en |
| dc.description.abstract | У статті розглядається метод здійснення динамічних викликів в .NET шляхом генерації коду на етапі компіляції. Проаналізовано традиційний механізм здійснення динамічних викликів у .NET, що базується на використанні рефлексії. Визначено, що ключовим недоліком такого підходу є швидкодія, що обумовлює необхідність пошуку альтернативного рішення для здійснення динамічних викликів. Проведено огляд останніх публікацій на тему оптимізації динамічних викликів у .NET. У результаті аналізу визначено, що низка існуючих рішень описує лише сам процес здійснення виклику, але не розглядає зберігання згенерованих функцій та структуру, яка б дозволила забезпечити їх повторне використання. Розглянуто рішення, що опирається на генерацію метаданих на етапі компіляції та асоціацію цих метаданих з відповідними статичними викликами. Запропоновано рішення, що також базується на генерації метаданих під час компіляції та їх асоціації зі статичними викликами.Перевагою запропонованого рішення над існуючими є можливість здійснення динамічних викликів для об\"єктів, які приведені до одного з базових типів, що розширює перелік сценаріїв застосування. Досягнути цього вдалося за рахунок використання структури метаданих, яка є подібною до рефлексії. Генерація метаданих реалізована з використанням Incremental Source Generators, що дозволяє забезпечити ефективну генерацію коду. Метод передбачає використання комбінації з двох генераторів коду, один з яких відповідає за генерацію самих метаданих, а інший – за генерацію коду об\"єднання цих метаданих в одну структуру. Для визначення типів даних, для яких необхідно виконувати генерацію, запропоновано використовувати як атрибути метаданих, так і спеціально визначені методи, що в якості аргументів приймають тип даних. Це дозволило використання запропонованого методу як для типів даних, визначених у контексті поточного синтаксичного дерева, так і для типів даних, що належать до зовнішніх бібліотек. Швидкодію розробленого методу було перевірено з використанням бібліотеки Benchmark.NET, у результаті чого встановлено, що запропонований метод має вищу швидкодію в порівнянні з рефлексією. | uk |
| dc.subject | метапрограмування | uk |
| dc.subject | .NET | en |
| dc.subject | рефлексія | uk |
| dc.subject | генерація коду | uk |
| dc.subject | Source Generators | en |
| dc.subject | metaprogramming | en |
| dc.subject | reflection | en |
| dc.subject | code generation | en |
| dc.type | Article, professional native edition | |
| dc.type | Article | |
| dc.language.iso | uk | uk |
| dc.date.accessioned | 2026-10-06T11:18:21Z |
Файли
Контейнер файлів
1 - 1 з 1
Вантажиться...
- Назва:
- 15 (1).pdf
- Розмір:
- 763,58 KB
- Формат:
- Adobe Portable Document Format