author: Joël Ledelay
title: Retrofitting Memoisation
company: ActFact
keywords: ActFact, optimisation, software improvement
topics: Case studies and Applications
committee: Vadim Zaytsev
started: November 2020
end: January 2021


The server side part of the ActFact UI implementation can, like most web applications, be thought of as a request pipeline. A request is received, processed and a response is created and shipped off.
Operations involving IO, specifically database access, and those performing parsing and evaluation of expressions (display, read-only, mandatory etc logic) take a significant part of the time needed to process
a typical request, and are thus a major contributor to the experienced UI performance.
Sometimes these operations are unnecessarily repeated while processing a particular request, in some rare cases up to hundreds or even thousands of times.
When performance issues like these are corrected, it is not unusual for them to reappear as a result of a seemingly small, unrelated change to the UI code. Avoiding or mitigating these issues typically involves
duplicated state, leading to a more complex architecture and codebase, and more defects.
We would like to investigate the possibility to add a "memoization" implementation, in order to cache function (method) results on a request scope level.