Optimizing Runtime Performance of Dynamically Typed Code

Dynamic languages are widely used for different kinds of applications including rapid prototyping, Web development and programs that require a high level of runtime adaptiveness. However, the lack of compile-time type information involves fewer opportunities for compiler optimizations, and no detect...

Descripción completa

Detalles Bibliográficos
Autor: Quiroga Álvarez, José|||0000-0002-1646-4796
Tipo de recurso: tesis doctoral
Fecha de publicación:2016
País:España
Institución:Universidad de Oviedo (UNIOVI)
Repositorio:RUO. Repositorio Institucional de la Universidad de Oviedo
Idioma:inglés
OAI Identifier:oai:digibuo.uniovi.es:10651/38325
Acceso en línea:http://hdl.handle.net/10651/38325
Access Level:acceso abierto
Palabra clave:Dynamic typing
Runtime performance
Optimization
Hybrid dynamic and static typing
Dynamic Language Runtime
Static Single Assignment
SSA Form
Multiple dispatch
Multi-method
Union types
Reflection
StaDyn
.Net
id ES_b108fe1caaa348b8b88c92ee3e7a38ec
oai_identifier_str oai:digibuo.uniovi.es:10651/38325
network_acronym_str ES
network_name_str España
repository_id_str
dc.title.none.fl_str_mv Optimizing Runtime Performance of Dynamically Typed Code
Optimización del rendimiento en tiempo de ejecución de código con comprobación dinámica de tipos
title Optimizing Runtime Performance of Dynamically Typed Code
spellingShingle Optimizing Runtime Performance of Dynamically Typed Code
Quiroga Álvarez, José|||0000-0002-1646-4796
Dynamic typing
Runtime performance
Optimization
Hybrid dynamic and static typing
Dynamic Language Runtime
Static Single Assignment
SSA Form
Multiple dispatch
Multi-method
Union types
Reflection
StaDyn
.Net
title_short Optimizing Runtime Performance of Dynamically Typed Code
title_full Optimizing Runtime Performance of Dynamically Typed Code
title_fullStr Optimizing Runtime Performance of Dynamically Typed Code
title_full_unstemmed Optimizing Runtime Performance of Dynamically Typed Code
title_sort Optimizing Runtime Performance of Dynamically Typed Code
dc.creator.none.fl_str_mv Quiroga Álvarez, José|||0000-0002-1646-4796
author Quiroga Álvarez, José|||0000-0002-1646-4796
author_facet Quiroga Álvarez, José|||0000-0002-1646-4796
author_role author
dc.contributor.none.fl_str_mv Ortín Soler, Francisco
Informática, Departamento de
dc.subject.none.fl_str_mv Dynamic typing
Runtime performance
Optimization
Hybrid dynamic and static typing
Dynamic Language Runtime
Static Single Assignment
SSA Form
Multiple dispatch
Multi-method
Union types
Reflection
StaDyn
.Net
topic Dynamic typing
Runtime performance
Optimization
Hybrid dynamic and static typing
Dynamic Language Runtime
Static Single Assignment
SSA Form
Multiple dispatch
Multi-method
Union types
Reflection
StaDyn
.Net
description Dynamic languages are widely used for different kinds of applications including rapid prototyping, Web development and programs that require a high level of runtime adaptiveness. However, the lack of compile-time type information involves fewer opportunities for compiler optimizations, and no detection of type errors at compile time. In order to provide the benefits of static and dynamic typing, hybrid typing languages provide both typing approaches in the very same programming language. Nevertheless, dynamically typed code in this languages still shows lower performance and lacks early type error detection. The main objective of this PhD dissertation is to optimize runtime performance of dynamically typed code. For this purpose, we have defined three optimizations applicable to both dynamic and hybrid typing languages. The proposed optimizations have been included in an existing compiler to measure the runtime performance benefits. The first optimization is performed at runtime. It is based on the idea that the dynamic type of a reference barely changes at runtime. Therefore, if the dynamic type is cached, we can generate specialized code for that precise type. When there is a cache hit, the program will perform close to its statically typed version. For this purpose, we have used the DLR of the .NET framework to optimize all the existing hybrid typing languages for that platform. The optimizations are provided as a binary optimization tool, and included in an existing compiler. Performance benefits range from 44.6% to 11 factors. The second optimization is aimed at improving the performance of dynamic variables holding different types in the same scope. We have defined a modification of the classical SSA transformations to improve the task of type inference. Due to the proposed algorithms, we infer one single type for each local variable. This makes the generated code to be significantly faster, since type casts are avoided. When a reference has a flow sensitive type, we use union types and nested runtime type inspections. Since we avoid the use of reflection, execution time is significantly faster than existing approaches. Average performance improvements range from 6.4 to 21.7 factors. Besides, the optimized code consumes fewer memory resources. The third optimization is focused on the improvement of multiple dispatch for object-oriented languages. One typical way of providing multiple dispatch is resolving method overload at runtime: depending on the dynamic types of the arguments, the appropriate method implementation is selected. We propose a multiple dispatch mechanism based on the type information of the arguments gathered by the compiler. With this information, a particular specialization of the method is generated, making the code to run significantly faster than reflection or nested type inspection. This approach has other benefits such as better maintainability and readability, lower code size, parameter generalization, early type error detection and fewer memory resources.
publishDate 2016
dc.date.none.fl_str_mv 2016
2016-06-01
dc.type.none.fl_str_mv doctoral thesis
http://purl.org/coar/resource_type/c_db06
NA
http://purl.org/coar/version/c_be7fb7dd8ff6fe43
dc.type.openaire.fl_str_mv info:eu-repo/semantics/doctoralThesis
format doctoralThesis
dc.identifier.none.fl_str_mv http://hdl.handle.net/10651/38325
url http://hdl.handle.net/10651/38325
dc.language.none.fl_str_mv Inglés
eng
language_invalid_str_mv Inglés
language eng
dc.rights.none.fl_str_mv open access
http://purl.org/coar/access_right/c_abf2
Attribution-NonCommercial-NoDerivatives 4.0 International
http://creativecommons.org/licenses/by-nc-nd/4.0/
dc.rights.openaire.fl_str_mv info:eu-repo/semantics/openAccess
rights_invalid_str_mv open access
http://purl.org/coar/access_right/c_abf2
Attribution-NonCommercial-NoDerivatives 4.0 International
http://creativecommons.org/licenses/by-nc-nd/4.0/
eu_rights_str_mv openAccess
dc.source.none.fl_str_mv reponame:RUO. Repositorio Institucional de la Universidad de Oviedo
instname:Universidad de Oviedo (UNIOVI)
instname_str Universidad de Oviedo (UNIOVI)
reponame_str RUO. Repositorio Institucional de la Universidad de Oviedo
collection RUO. Repositorio Institucional de la Universidad de Oviedo
repository.name.fl_str_mv
repository.mail.fl_str_mv
_version_ 1869416876622217216
spelling Optimizing Runtime Performance of Dynamically Typed CodeOptimización del rendimiento en tiempo de ejecución de código con comprobación dinámica de tiposQuiroga Álvarez, José|||0000-0002-1646-4796Dynamic typingRuntime performanceOptimizationHybrid dynamic and static typingDynamic Language RuntimeStatic Single AssignmentSSA FormMultiple dispatchMulti-methodUnion typesReflectionStaDyn.NetDynamic languages are widely used for different kinds of applications including rapid prototyping, Web development and programs that require a high level of runtime adaptiveness. However, the lack of compile-time type information involves fewer opportunities for compiler optimizations, and no detection of type errors at compile time. In order to provide the benefits of static and dynamic typing, hybrid typing languages provide both typing approaches in the very same programming language. Nevertheless, dynamically typed code in this languages still shows lower performance and lacks early type error detection. The main objective of this PhD dissertation is to optimize runtime performance of dynamically typed code. For this purpose, we have defined three optimizations applicable to both dynamic and hybrid typing languages. The proposed optimizations have been included in an existing compiler to measure the runtime performance benefits. The first optimization is performed at runtime. It is based on the idea that the dynamic type of a reference barely changes at runtime. Therefore, if the dynamic type is cached, we can generate specialized code for that precise type. When there is a cache hit, the program will perform close to its statically typed version. For this purpose, we have used the DLR of the .NET framework to optimize all the existing hybrid typing languages for that platform. The optimizations are provided as a binary optimization tool, and included in an existing compiler. Performance benefits range from 44.6% to 11 factors. The second optimization is aimed at improving the performance of dynamic variables holding different types in the same scope. We have defined a modification of the classical SSA transformations to improve the task of type inference. Due to the proposed algorithms, we infer one single type for each local variable. This makes the generated code to be significantly faster, since type casts are avoided. When a reference has a flow sensitive type, we use union types and nested runtime type inspections. Since we avoid the use of reflection, execution time is significantly faster than existing approaches. Average performance improvements range from 6.4 to 21.7 factors. Besides, the optimized code consumes fewer memory resources. The third optimization is focused on the improvement of multiple dispatch for object-oriented languages. One typical way of providing multiple dispatch is resolving method overload at runtime: depending on the dynamic types of the arguments, the appropriate method implementation is selected. We propose a multiple dispatch mechanism based on the type information of the arguments gathered by the compiler. With this information, a particular specialization of the method is generated, making the code to run significantly faster than reflection or nested type inspection. This approach has other benefits such as better maintainability and readability, lower code size, parameter generalization, early type error detection and fewer memory resources.This work has been partially funded by the Spanish Department of Science and Technology, under the National Program for Research, Development and Innovation. The main project was Obtaining Adaptable, Robust and Efficient Software by including Structural Reflection to Statically Typed Programming Languages (TIN2011-25978). The work is also part of the project entitled Improving Performance and Robustness of Dynamic Languages to develop Efficient, Scalable and Reliable Software (TIN2008-00276). I was awarded a FPI grant by the Spanish Department of Science and Technology. The objective of these grants is to support graduate students wishing to pursue a PhD degree associated to a specific research project. This PhD dissertation is associated to the project TIN2011-25978 (previous paragraph). This work has also been funded by Microsoft Research, under the project entitled Extending dynamic features of the SSCLI, awarded in the Phoenix and SSCLI, Compilation and Managed Execution Request for Proposals. Part of the research discussed in this dissertation has also been funded by the European Union, through the European Regional Development Funds (ERDF); and the Principality of Asturias, through its Science, Innovation Plan (grant GRUPIN14-100).Ortín Soler, FranciscoInformática, Departamento de20162016-06-01doctoral thesishttp://purl.org/coar/resource_type/c_db06NAhttp://purl.org/coar/version/c_be7fb7dd8ff6fe43info:eu-repo/semantics/doctoralThesishttp://hdl.handle.net/10651/38325reponame:RUO. Repositorio Institucional de la Universidad de Oviedoinstname:Universidad de Oviedo (UNIOVI)Inglésengopen accesshttp://purl.org/coar/access_right/c_abf2Attribution-NonCommercial-NoDerivatives 4.0 Internationalhttp://creativecommons.org/licenses/by-nc-nd/4.0/info:eu-repo/semantics/openAccessoai:digibuo.uniovi.es:10651/383252026-06-07T06:38:51Z
score 15,301603