I have a fairly complicated mathematical function that I've been advised should be implemented as a User Defined Function in SQL Server so that it can be used efficiently from within a SQL query. 

The problem is that it **must** be very efficient as it may be executed thousands of times per second, and I subsequently heard that UDFs are very inefficient.

Someone suggested that I could implement the function in C# instead, and that this would be much more efficient.

What should I do?