Optimizing Sideways Composition: Fast Context oriented Programming in ContextPyPy
The prevalent way of code sharing in many current object systems is static and/or single inheritance; both are limiting in situations that call for multi dimensional decomposition. Sideways composition provides a technique to reduce their limitations. Context oriented programming (COP) notably applies sideways composition to achieve better modularity. However, most COP implementations have a substantial performance overhead. This is partly because weaving and execution of layered methods violate assumptions that common language implementations hold about lookup. Meta tracing just in time (JIT) compilers have unique characteristics that can alleviate the performance overhead, as they can treat lookup differently. We show that meta tracing JIT compilers are good at optimizing sideways composition and give initial, supporting results. Furthermore, we suggest that explicit communication with the JIT compiler in a COP implementation can improve performance further.
COP@ECOOP