Benchmarking Generic Functions in Rust

Researcher(s)

Sponsoring Agency
Mozilla Corporation

Summary

Rust is a new programming language invented and maintained by Mozilla. The design goal of Rust is to provide similar performance as C while avoiding the memory and concurrency safety issues in C. To achieve the goal, Rust proposes many compiler checking routines centered around its ownership mechanism. Due to its safety and performance, Rust has gained increased popularity over the past few years, especially in building low-level software like libraries, OSes and browsers.

Rust supports generic functions to improve code reuse. A generic function in Rust is like a function template in C. It takes parameters in generic types during declaration and adapts its functionalities based on different concrete types specified at its call sites. There are two algorithms to process generic functions, monomorphization and dictionary passing. We propose to benchmark generic functions in Rust and systematically compare monomorphization with dictionary passing from three aspects: compilation time, the size of generated code and execution performance of compiled executables. The proposed project can help Rust designers better understand design choices when handling generic functions and serve as a testing set for the future evolution of the Rust compiler.

Term
 -