Im wondering what DF goes if the 'closest' item that it picked is blocked and inaccessable; does it do pathfinding, fail, pick another, pathfind.... until successful?
What might be better is not checking the entire list of objects just to select the closest one...
Another way to do the search is by following dwarf-accessable paths starting from the workshop, until an appropriate item is found, or all paths dead end. The bonus being that whatever path is found to the item, can also be used by the dwarf to get the item.
There would have to be a limit on the distance searched before falling back to the enumeration method, to put a cap on the search in case the nearest item is many hundreds of tiles away; or doesn't exist at all.
That also depends on if a tile 'knows' what items are in it; or if checking what items are in a tile would also require going through the entire list... and going through the list may also be required to see if there are any valid items at all; no point doing any path calculations in that case; but then you've gone through the list, and simply summing the differances in x/y/z could have been done while doing so...
Being able to assign a stockpile for a workshop to 'take from' would pretty much eliminate most of that work anyway, and would allow players to better control what gets produced.
As for multithreading, using multiple threads is easy; but doing it correctly, is very hard.