McLeodMoores / xl4j

Framework for writing Excel Add-ins in Java
Other
7 stars 3 forks source link

Reverse lexically sort FunctionDefinitions returned to Excel #86

Closed jimmoores closed 7 years ago

jimmoores commented 7 years ago

xlfRegister internally uses inserts into a linked list, so each insertion takes O(n), meaning inserting n functions becomes n^2 if we don't pre-sort them. Pre-reverse-sorting means that Excel will only ever need to compare with the first function in the list (or a few more if other XLLs register a lot too). This only matters with very large numbers of UDFs, but we're likely to run into this if we start using reflection to create wrappers for larger libraries.

jimmoores commented 7 years ago

E, any chance you could tackle this - the stuff returned to Excel just needs to be sorted into reverse lexical order by the workbookName field (I think that's what it's called, it's the actual name of the function as it appears in Excel).