Hi, i have some function which works with linked list, this linked list is created in this function, the size of linked list can be more than 100 000. the problem occured when function end. a lot of time is required to call desctructor to each item of linked list. my question is, can i call desctructors in treads.
for example, if i have linked list containing 30 000 elements, i will create 3 threads which will explicitly call desctructors for elements of this linked list.
for elements 0..9999 first thread, for elements 10 000...19 999 second ...
the type of linked list is like
list<UserDefinedType> myList;
where UserDefinedType has vector, string, list... members;
In principle, you can, but you need to be clear on what you intend to do.
A possible performance improvement can only come from a multi core/processor. You may have to add the scheduling cost. The heap is often protected by a single mutex that will serialise the threads. So a threaded solution may be slower.