On Sun, Apr 8, 2012 at 08:29, Isaac Schlueter <[email protected]> wrote: > I'm exploring domains now. Adding a hook into MakeCallback would be > nice, actually. You can get pretty far without it, but not quite as > far as I'd like. Having a single point where all JS->C++ callbacks > flow through is really nice, and generally good design, imo. > Scrapping it entirely is a waste of an opportunity. We ought to just > make it not suck. > > What I'm noticing is: > > 1. We don't use MakeCallback quite everywhere that we could. > 2. It uses a char* each time, rather than storing a symbol, or just > taking a function. > > For #1, it looks like a modest change to node_file.cc and a few other > places can clean this up pretty easily. > > For #2, I'm going to investigate the performance impact of changing > this function signature to take a Handle<Function> instead of a const > char*. That would make for slightly more complexity in the consumers, > since they'll have to store a symbol or something, but it'll also > probably run faster. We'll see.
It will have to be this. Both String::New() and Object::Get() are expensive. > Another option would be to make every ReqWrap object's callback named > "oncomplete" or perhaps some small set of consistent names, so that > the same symbol could be used over and over again.
