Thanks for the reply. My first thought about the scheme was that I can avoid the small memory allocation needed for each handle. On second thought, I could simply use a persistent array instead. I am not sure it will make any difference performance-wise.
On Monday, October 3, 2016 at 4:30:36 AM UTC-5, Ben Noordhuis wrote: > > On Sun, Oct 2, 2016 at 6:39 PM, mh <[email protected] <javascript:>> > wrote: > > Consider > > v8ObjectTemplate templ = ObjectTemplate::New(isolate); > > templ->SetInternalFieldCount(100); > > v8Object obj = templ->NewInstance(context).ToLocalChecked(); > > > > 'obj' is stored as a Persistent on the heap. The plan is to keep > > additional Values stored as internal fields. Some of these may be > Reset() > > which means house-keeping code for a list of available indices. > > > > Questions: > > > > 1) Will this scheme degrade GC performance as opposed to having separate > > Persistent handles for all of these additional Values? > > It's probably a little more efficient than separate Persistent handles > unless the internal fields array is large but sparse (i.e., when only > a fraction of the elements are in use.) > > > 2) What is limit on the number of internal fields? > > It should be large enough for your purposes. The theoretical limit is > 2^30, the effective limit is what fits on the JS heap. > -- -- 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.
