I'm doing some performance comparisons of hand crafted XLL vs XLW v4.
My results suggest that a trivial function in plain old C is 1000 times fasted than XLS equivalent.
My test case is a sheet with 2000 of these functions in a 26x80 grid.
The XLW version manages 2500 cells per second and completes in 798 ms
The primitive approach manages 1 or 2 million cells per second and completes in 1 or 2 milliseconds.
Is this expected?
Is there a tuning that I am missing out on?
Clearly there is a lot more code between Excel and my fn() in the XLW variant but I was still surprised by the difference.
In my use case processing time is critical.
My examples are trivial but I can supply them if required.
// XLW Function
double Ticky( )
{
DWORD d = GetTickCount();
return (double)d;
}
// Plain old XLL function
EXPORT double FastTicky ( )
{
double d = (double)GetTickCount();
return d;
}
With XLW there are 2 main modes of operation, handwritten or auto-generated.
It would seem you are using the auto-generated approach. In version 4 the automatic layer adds some memory management and checks for being called in function wizard which are quite slow.
For high performance with XLW 4 use the handwritten mode, With your example it would be possible to get identical performance.
If you want to start using eth XlfOper structures then there is a memory management function whose performance has been improved in version 5.
Also in version 5 it is possible to disable the function wizard check by adding the //<xlw:fast tag above the function definition.