You could also just

var symbol = new Private()
o[symbol] = {__proto__:null}
o[symbol]["your key"] = ...

On Fri, May 6, 2016 at 8:58 AM Jochen Eisinger <[email protected]> wrote:

> You don't have to use ForApi() to create privates, you can create the once
> and then keep them around as keys.
>
> Another alternative is to maintain a weak map from the objects to your
> properties.
>
> On Thu, May 5, 2016 at 2:46 PM Danny Dorfman <[email protected]>
> wrote:
>
>> Hello there,
>>
>> I am looking for a time-efficient way to store private (hidden) values in
>> an object. I get key-value pairs
>> (where key is of type v8::String and value of type v8::Value), and I need
>> to attach them to existing objects.
>>
>> What I came up with so far - is using v8::Object's SetPrivate() function.
>> The only problem with it, is that this method
>> takes a v8::Private as its first argument. There is a costly conversion
>> between v8::String to v8::Private (using the ForApi method).
>> Performance goes down, and after profiling with callgrind, I see that
>> ForApi is taking up too many cycles.
>>
>> Is there a quicker way to accomplish this? (I am running 4.9)
>>
>> Regards,
>> Danny
>>
>> --
>> --
>> 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/d/optout.
>>
> --
> --
> 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/d/optout.
>

-- 
-- 
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/d/optout.

Reply via email to