On Tue, Sep 11, 2012 at 7:19 AM, Stuart Allen <[email protected]> wrote: > Hi, > > I stumbled across a very strange problem. I'm using 3.12.19.1 on Linux > 64-bit. > > I have an object implemented in C++, I noticed an unexpected slow-down and > eventually traced it to a particular call. > > If the object method is called like this: > > this.MyObject.method() > > > it takes 20ms (milliseconds) to execute, when it should be 0ms. I made > timings inside C++ and they show a total 0ms execution time so the 20ms is > introduced inside the JS<->C++ boundary. > > On a hunch I tried this: > > var cn= this.MyObject.method; > cn();
For the record, this call has different semantics: it won't pass MyObject, but rather the global object, as "this". Not that that would immediately explain the timing difference you see. I think you may need to post some more context code. Especially regarding the construction of "MyObject" including "method". Is the timing you see measured as an average of many loop iterations or just one call? Matthias > > > and guess what, it takes 0ms!! > > methods of the same Object instance are called before and after yet they > execute as expected with no measurable overhead (in millsecond land). > > Is there any foundation for such a problem? Could it be a scoping/resolving > issue causing problems resolving the method? > > Are there any diagnostics that could help here? > > Thanks, > > Stuart. > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
