On Wed, Feb 18, 2004 at 07:37:02PM -0800, Scott wrote:This is the difference against the version I checked out of cvs this morning...
The difference is very favorable, here are my benchmark results:
POE::Kernel->call(): 123 wallclock secs (111.82 usr + 0.86 sys = 112.68 CPU) @ 8874.69/s (n=1000000)
POE::Kernel->invoke(): 33 wallclock secs (28.74 usr + 0.05 sys = 28.79 CPU) @ 34734.28/s (n=1000000)
Out of curiosity, what are the numbers like for call() when your optimization patch is applied? That would better reflect what we have in CVS right now.
[EMAIL PROTECTED]:~/dev/contrib/POE/poe$ perl -Mblib test_invoke.pl Benchmark: timing 1000000 iterations of POE::Kernel->call(), POE::Kernel->invoke() ...
POE::Kernel->call(): 61 wallclock secs (58.84 usr + 0.02 sys = 58.86 CPU) @ 16989.47/s (n=1000000)
POE::Kernel->invoke(): 29 wallclock secs (27.23 usr + 0.03 sys = 27.26 CPU) @ 36683.79/s (n=1000000)
Although the optimization of call() makes a big difference, its still considerably faster.
Re: gosub ... The only thing I dont like about that method name is that it doesn't really follow the naming patterns of anything else in the kernel.
ID ID_id_to_session ID_session_to_id alias_set alias_remove alias_resolve alias_list select_read select_write select_pause_write select_resume_write select_pause_read select_resume_read select_expedite select_expedite select sig sig_handled signal state refcount_increment refcount_decrement get_active_session delay alarm run post yield call
At the end of that list, gosub seems kind of funny to me :)
invoke seems more in place but the only problem I can see is I really can agree that invoke means basically the same thing as call. However, post and yield in their contexts dont really seem to have a greatly differing meaning either. Post being to broadcast (or arguably to publish), yield being to submit (possibly following natural form). call being to demand, invoke being to activate. Rightly so, invoke and call do in fact have the same end result. Each having their place, the difference is very little all in all, aside from short hand. Realistically it would be more logical to have invoke and call trade places, call being the shorthand (as call seems to denote more of a demand than invoke, and the session local short hand being the faster of the two) but the idea really is *not* to name it after its optimizations. Not that it isn't faster, at this current time, than call. But that the optimization is just an implementation detail and so not to be worried much about.
On a side note maybe I should mention in the documentation that since invoke bypasses the garbage collection, invoking an event that either adds to the fifo, sets an alias, or increases the sessions ref count would cause garbage collection of a session that is ready to die to be postponed as it stops POE from checking it until the outer most event returns and session context switches. Also, since this is now the case with call as well.
Anyway, I very much realize the naming isn't entirely up to me but personally I would prefer a short, single word name that denotes the activity of the method as opposed to something that doesn't seem proper in the context of the kernel, simply inherited from some programming language I've never used. But thats just my personal preference.
- Scott
