As a scientific programming language, Julia strives for performance but also provides high-level productivity features. To avoid performance pathologies, Julia users are expected to adhere to a coding discipline that enables so-called type stability. Informally, a function is type stable if the type of the output depends only on the types of the inputs, not their values. This paper provides a formal definition of type stability as well as a stronger property of type groundedness, shows that groundedness enables compiler optimizations, and proves the compiler correct. We also perform a corpus analysis to uncover how these type-related properties manifest in practice.
翻译:作为科学编程语言,Julia努力追求业绩,但也提供了高水平的生产力特征。为了避免业绩病理,Julia用户应该遵守一种编码纪律,从而能够实现所谓的类型稳定性。非正式地说,如果产出的类型仅取决于投入的类型,而不是其价值,则该函数的类型是稳定的。本文对类型稳定性提供了正式定义,并提供了更强有力的类型基础属性,表明基于基础可以优化编译者,并证明编译者是正确的。我们还进行了一项内容分析,以揭示这些类型相关属性在实践中的表现。