# Compiled NormFunction

I would like to use a user-defined NormFunction with NDSolve, e.g.,

NormFunction -> (Norm[Take[#, 2], \[Infinity]] &)


which says that the infinity norm should be used on the first two state variables.

How can I use a compiled version of the NormFunction above? When using a user-defined NormFunction integration seems to take longer time, and this seems to be because the NormFunction is not compiled. I believe that this is the case since when I define a user-defined norm returning the default norm it takes longer time compared to when not specifying it (and hence get the default norm automatically).

Any suggestions?

-