In order to achieve high performance on modern and future machines, applications need to make effective use of the complex, hierarchical memory system. Writing performanceportable code continues to be challenging since each architecture has unique memory access characteristics. In addition, some optimization decisions can only reasonably be made at runtime. This suggests that a two-pronged approach to address the challenge is required. First, provide the programmer with a means to express memory operations declaratively which will allow a runtime system to transparently access the memory in the best way and second, exploit runtime information. MPI's derived datatypes accomplish the former although their performance in currentMPI implementations shows scope for improvement. JIT-compilation can be used for the latter. In this work, we present DAME | a language and interpreter that is used as the backend for MPI's derived datatypes. We also present DAME-L and DAME-X, two JIT-enabled implementations of DAME. All three implementations have been integrated into MPICH. We evaluate the performance of our implementations using DDTBench and two mini- Applications written with MPI derived datatypes and obtain communication speedups of up to 20x and mini- Application speedup of 3x.