Software Network Functions (NFs) promise increased flexibility and easy development process of network services by moving functionality away from dedicated hardware devices to standard general-purpose servers. Traditional approaches to design and develop those NFs are based on a static compilation, where the input of the compiler is a fixed description of the forwarding plane semantics and the output is the code that can accommodate any packet processing behaviour set by the controller at run-time. Ideally, the compiler should automatically optimize the generated code depending on the declarative description of the data plane semantic that is available in the original NF code. However, it is also true that the actual packet processing behaviour of the data plane program is available only at runtime. In this talk, I will propose a dynamic approach to the data plane compilation, where not only the static features but also the run-time data are exploited to further optimize the output program. This would make it possible to generate a custom version of the original NF that is optimal to the data plane semantic and the packet processing behavior at the same time, hence being able to considerably improve the performance of the original application even by a 40-50% factor.