Jens,

persistent handles are not free as well (they need to be traversed on
GCs).

That should be relatively easy to speed those methods up---I'd
guess that references for underlying v8 objects never change (or could
be done so) and thus that could be fully inlined and be just of couple
operations.  And that sounds as a good idea overall, but could you
write a quick test and see if it buys a lot: the idea is to write
microbenchmark which returns empty handle instead of v8::True(), etc.
The tricky point is to make it realistic---so probably some minimal
setup should be performed before returning.

yours,
anton.

On Tue, Oct 27, 2009 at 9:13 PM, Jens Alfke <[email protected]> wrote:
>
> I'm optimizing the generated V8/DOM bindings in Chrome. One thing I've
> noticed is that any method that returns a JS 'boolean' ends with:
>        return result ? v8::True() : v8::False();
> Both of those functions call into V8 proper, where they seem to invoke
> a nontrivial amount of code. The same goes for v8::Null() and
> v8::Undefined().
>
> Since these values are, I would imagine, constants, is it possible for
> me to call them once, store them in PersistentHandles, and then re-use
> those cached values? That way I could reduce the above idiom to a
> couple of inlined instructions.
>
> —Jens
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to