note creating a large number of internal fields will require an unusually large time to mark - for fixed arrays we have special code to mark them incrementally, but for regular objects, we assume that they only contain a few pointers.
I'd advise to go for multiple persistent handles. On Mon, Oct 3, 2016 at 1:03 PM mh <[email protected]> wrote: > 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]> 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. > -- -- 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.
