I have created a class library which does some geoprocessing. The addin calls a class that is an async process. I have ensured the thread is STA and the arcobjects are thread safe (ie. not passed from the addin). All arcobjects are created within the thread.
Because this is a class library I wrapped it in a winforms UI and also as an addin. Both sets of code are exactly the same and test were performed using the exact same data. Both the winforms and addin complete the code with the desired results and no memory leaks are evident. For the case of the addin there is no interaction with the map period at this point and there are no mapping or display elements in the winforms code either.
the only UI updates are the update of a progress dialog in both the addin and UI. The addin is using a dockable window (user control ui).
The issue I am seeing is when the library is called from the addin, code execution is 5x slower than the same code called through the winforms application.
Any ideas on where I might look to see why this is occurring?