On Sat, Apr 27, 2013 at 10:36 AM, Dmitry Azaraev
<[email protected]> wrote:
>> Boolean values are eternal --- they never die. Small integers (31 bits on
>> ia32 and 32bits on x64) are
>> not even allocated in the heap, they are *values* essentially so weak
>> reachability is undefined for them.
>    Thanks. I'm trying allocate non-SMI values too - and got same result, so
> looks, that exists some additional rule. May be exist easy way to detect
> which values can be used as weak headles or no?

As a rule of thumb, you should only turn Objects* and Strings into
Persistent handles.  Even then it may be a worthwhile tradeoff to just
take the hit and construct a new object every time rather than caching
it in a Persistent handle.  (Caveat emptor: as with all
performance-related advice, don't take it on face value - benchmark
it.)

If you find yourself returning a lot of non-SMI numbers, it may be
worth it to return them in a pre-allocated typed array rather than
directly.  We use that trick in node.js to avoid excessive heap
allocations.

* That includes Arrays but if your array contains only numeric values,
you can often use the typed array trick.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to