Efficiency of subtype test in object oriented languages with generics

Alexandre Terrasa, Jean Privat
2013 Proceedings of the 8th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems - ICOOOLPS'13  
In a programming language, the choice of a generics typing policy impacts both typing test semantics and type safety. In this paper, we compare the cost of the generic policy chosen and analyze its impacts on the subtype test performance. To make this comparison we implement two compilers for the Nit language. One applies covariant policy using a homogeneous implementation and the second applies an erased policy and implementation. We compare the time efficiency of our solution against engines
more » ... or C++, C#, Eiffel, Java and Scala. Results show that our implementations give the best performances compared to existing solutions. We also compare covariant and erased policies on existing Nit programs using our two compilers. Results show that covariance does not imply significant overhead regarding subtype test performances. Due to the small difference between the costs of the different policies, the choice of a policy by a language designer should not be influenced by performance considerations.
doi:10.1145/2491404.2491406 dblp:conf/ecoop/TerrasaP13 fatcat:crg7vfjdsvashdyevroubzmtei