On Monday, October 5, 2015 at 3:34:43 PM UTC-4, Matt wrote:
>
> Most of the time I read Julia code with generated functions, the goal is loop 
> unrolling <https://en.wikipedia.org/wiki/Loop_unrolling> (included the 
> main example in the documentation 
> <http://julia.readthedocs.org/en/latest/manual/metaprogramming/#generated-functions>
> ).
> What are other good cases to use @generated functions?
>

Keno's C++ interface (https://github.com/Keno/Cxx.jl) relies on generated 
functions.  In order to call C++ functions, you need to know the argument 
types, and you don't generally know types until compile time.  By allowing 
the C++ call to be computed at compile time via generated functions, you 
pay no runtime overhead for invoking the enormous Clang machinery to figure 
out C++.

Reply via email to