• apply/call shouldn't copy any arguments.

    The usage of .foo was just to see if trying to access a field in the agent array was slow - but if you're saying that each call takes 15/10=1.5 seconds to complete then that won't be the problem. We'd be talking about a maximum of a few milliseconds.

    So you're saying that removing the call to agent._send from callback speeds execution up a lot. Surely that implies that agent._send is the thing that's slowing it all down?

    I mean, if agent[message.content.method] was just function(){} I guess this would run pretty quick regardless of the way it was called? Why not try changing the function to function() { print(arguments); } and see if anything is obviously different between calls?

    This all looks too complicated for me to be able to help out. If you can get a simple test case that exhibits the behaviour I'll be able to look into it properly - but until then I'm not sure what I can do.

About

Avatar for Gordon @Gordon started