At the time of creating the threads in question, no modules, except threads has been loaded, however, modules are loaded after this. Would it be feasible that Perl is trying to clone the modules, even if they have not been loaded yet?
ray -----Original Message----- From: Elizabeth Mattijsen [mailto:[EMAIL PROTECTED]] Sent: 21 September 2002 21:13 To: Ray Hilton; [EMAIL PROTECTED] Subject: Re: iThread Speed. At 12:09 PM 9/20/02 +0100, Ray Hilton wrote: >Now that DBD::mysql has been updated to support the CLONE() method, I >have been trying to port this software im working on to iThreads, all >seems fine and dandy until I try to spawn threads, it is VERY slow. I >thought this may be to do with where in the process I am starting the >threads etc, so had a play with Thread::Pool, but no joy, it seems that >even if I spawn 10 threads at the very beginning, even before any >modules have been loaded, it takes about 7 seconds. However, if I write >a script that just contains the thread spawning stuff, and nothing else, >it takes about 0.1 seconds. > >So, from this, I am assuming that the total size of the application is >much more an influence on speed of the application than where in the >process you spawn the threads from. Has anyone experience of this? And >possibly work arounds? Sorry for answering this late, I just got back from the YAPC::Europe... Thread spawning speed is in my experience directly related to the number of modules that have been loaded when you start spawning threads. The reason for this is the cloning process: it not just copying data but also fixing up. Suppose you have a reference to a list in a variable. The list _and_ the variable are cloned to the thread. But the reference inside the variable needs to be fixed up to point to the cloned list, not the original one. It's stuff like this that makes Perl threads, ehm, not light-weight... Liz
