in reply to Will closure increase performance thread processing subroutine?
There is too little code here to understand how it is used, and too little description to understand what if any problems you might or might not be having.
You talk about threads but there is no threading shown. If the sub refresher() is being called as a thread procedure, then utilising closures over variables that exist in the calling thread, without also sharing those variables, makes no sense at all. Those closures will be cloned each time you start a new thread, and any changes made to them will not be reflected back into the original hashes, and so will be lost when the thread ends.
You seem to be worrying about the performance, without realising that the code you are worrying about probably doesn't work. (Almost certainly doesn't, but it is impossible to tell for sure with seeing where, how and why the code is being called.)
To get any answers that are meaningful(*), you will have to post a cut-down, working demonstration of how you envisage this code working and being used.
|
|---|