@Scott Doy! I didn't take time to see that. Thanks.
@Gildas Thanks for expanding the test! It's very interesting to note how protyped instances and global methods both perform well. I'd assume, it's because both optimize memory usage, while inlined and composed objects require more memory pointers/references. Quite useful when it comes to designing a class-inheritance model. Thanks again! - best, bemson On Apr 29, 1:32 pm, Gildas <[email protected]> wrote: > On Apr 29, 4:43 pm, Bemi Faison <[email protected]> wrote: > > > @Gildas > > > I think that's incredibly useful information. Thanks for the link! > > > What about "building" an object? I don't know whether to call it > > object-composition or the object-factory pattern, but don't libraries > > use this to provide advanced object-inheritance features? I've always > > felt this would be incredibly slow - compared to using the prototyype > > chain or assigning privileged methods within a constructor. > > > How fast is it to return created objects? (I'm not even sure if this > > is how the object-factory pattern works exactly - that is, without the > > "new" operator.) Could you add something like this to your tests? > > It's the worst way of creating and using (i.e. method call) objects in > term of speed in my test. It's not really surprising ;) > > Scott is right, you can make a new version of any test available on > jsperfs.com: just just have to add "/edit" on the URL. You can also > make yours. > Anyway, I added your code suggestion in revision 6. The test is > slightly different since my colleague remarked to me it world be > interesting to split object creation and method call to simplify > results readability. > > See here:http://jsperf.com/prototype-members-vs-instance-members/6 -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
