Thanks Jakob. Jakob Kummerow於 2013年4月1日星期一UTC+8上午3時59分10秒寫道: > > On Sun, Mar 31, 2013 at 4:16 PM, Sam Lin <[email protected] <javascript:> > > wrote: > >> Hi, >> >> 1. Numbers: >> About the tagging technique, Objects and small integer are both to be >> set as 32 bits. >> Further, they use the bottom bit as the tagged value. if the bit is >> set, then this means that 31 bits are object pointers >> (Does this mean each bit points to the object accordingly?). >> Otherwise, then that 31 bits represent integer values. >> I think my understanding so far is correct. Let me know if I am wrong >> here. >> However, I dont really understand why v8 does this and how this >> tagging technique can improve the performance. >> > > Not having to box numbers is a performance advantage. If you don't box > them, you need to recognize them somehow, hence the tagging. > > >> >> 2. Arrays: >> I went through the slides, there are two types of ways that how v8 >> handles elements: >> 1. Fast elements: Linear storage for compact key sets. >> This is understandable that this one should be very fast. But I >> dont know what does "key sets" mean here? >> > > "Set" in the mathematical sense: the set of all keys. > > >> 2. Dictionary elements: Hash table storage. >> The speaker(Google i/o 2012) mentions this one is much more >> compact than the first one. >> I thought this one is slower because the v8 switches to this mode >> because the array is sparse. >> Why the speaker says this one is more compact? >> > > Dictionary mode allows a compact representation of arrays with sparse key > sets. > > >> 3. As the speaker gave an example, >> var A = new Array(); >> A[0] = 77; >> A[1] = 88; >> A[2] = 0.5; >> A[3] = true; >> This will cause the hidden class changes a couple of times which >> cost resources. >> >> The better way suggested by v8 is: >> var A= [77,88,0.5,true]; >> He said this is a hint to v8. But could any one explain this more >> specifically on how v8 take this single allocation? >> > > When various object types are listed in the array literal, V8 can see > right away what kind of stuff will be stored in the array. > > Also, for the record, it is generally advisable not to mix types of > objects stored in an array, especially if some of them are numbers. Arrays > containing only numbers enable some optimizations that make working with > them faster. > > >> >> Some questions here. Thanks for your reply in advance. >> >> >> >> Regards- >> >> >> -- >> -- >> v8-users mailing list >> [email protected] <javascript:> >> 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] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > >
-- -- 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.
