Master's Thesis
Using Relational Algebra to Facilitate Safe Refactoring for Performance in Rust

Eric Michael Sumner

Háskóli Íslands



The choice of how to organize data in memory has a significant effect on the overall efficiency of computer programs. Changing requirements over time may require this choice to be revisited after a program’s initial development has been completed. Historically, data retrieval routines and program logic have been strongly coupled, which hinders the maintenance programmer’s ability to reorganize a program’s data without introducing new logic faults.

This paper proposes a new framework, Memquery, which separates these two concerns, allowing a program’s internal data to be reorganized without major changes to its logic routines. The theoretical basis for this framework is relational algebra, which has served a similar role in database systems for the past 50 years. A prototype of the Memquery framework is presented. A comparison study with traditional development techniques demonstrates that this prototype is capable of producing more maintainable programs with similar performance characteristics.

I originally developed Memquery for my Master’s thesis at the University of Iceland. The source code is available on GitLab, and the reusable crates can be downloaded via cargo:


I defended my thesis on 20. May 2021, a recording of the presentation is below.