[...]
I suspect it's that TagManager, for every single tag, is inserting the tag into the tags array, removing duplicates, and then re-sorting the entire array.
All of the above prevent concurrent access :)
The actual code/algos in use in TM is quite optimized, but I think the whole approach is flawed.
The best way IMO would be to use a lightweight DB like SQLite, where you can slam a bunch of data into it while it's in memory and then deal with sorting/searching during the queries later (or rather let the DB engine deal with them). IIUC, this would make threading much easier too, allowing one (or more) threads to be parsing and dumping tag info into the DB, while the UI is still running fine and seeing the new tags as they get inserted. You could also flush the DB to disk and use it as an index, so next run, much less work needs to be done over.
Not so easy, from the sqlite faq:
(6) Is SQLite threadsafe?
Threads are evil. Avoid them.
And what they don't mention is that you can deadlock your system if the access isn't coordinated, ... back to square one.
The chief benefit would of course be dropping all the TM code that no one really understands :)
For another bunch noone really understands </optimist> :)
Cheers Lex