Faster compared to what? If you mean faster execution compared to the anonymous function eval-ed from the Val{true} expression, then that’s not true.
The real benefit of RuntimeGeneratedFunction is that it can be instantiated and compiled during a method call without hitting world-age issues like a eval-ed expression would. You’re not doing this inside a method, so this doesn’t apply. If you really want to write an anonymous function to another file given a RuntimeGeneratedFunction, then RuntimeGeneratedFunctions.get_expression can help get the Expr back before you convert it to a string, but the Val{true} option saves you all that circular work. To put it another way, you already did the right things, Val{false} would only do more work you don’t need and would reverse.
There is a potential source of poorer performance in your working code however. Your f is a non-const global variable, so if you call its function in another method, the compiler cannot assume f always references the same function. That results in call overheads and poor type inference optimizations following the call. The fix is simple, write const f = include("generated_function.jl"). Note that named function and type definitions in the global scope are implicitly const as well, that’s important for compiler optimizations.