Le 19/03/2012 23:12, Allen Wirfs-Brock a écrit :
On Mar 19, 2012, at 2:36 PM, David Bruant wrote:
Le 19/03/2012 21:10, Maël Nison a écrit :
Hi,
I'm 'upping' this discussion for two reasons :
- I didn't send any response before ! I didn't know that some parts of
V8 were self-hosted, so I'm glad to have learn that. Thanks. : )
- I've just read this article [1] on the web, and it reminds me this
discussion. The author is explaining a valid use case of mutable
functions (preventing useless garbage collection). It's true that in
real time application, garbage collection consume a lot of processing
time (factories or persistent objects are not uncommon [2] [3] [4]).
What do you think about this ?
My opinion hasn't changed. You can still add these methods yourself to
Array.prototype. You are even encouraged to do that and remove methods
abusively creating new arrays if it helps promote array reusability in
your own code.
Implicit in the original post is the assumption that removing (or adding)
elements to an existing object is more efficient (in all performance
dimensions) than creating a new object with the desired elements. That isn't
always the case...
Indeed. The wipe function may have terrible performances if there are a
lot of properties (especially the for-in + hasOwnProperty that could
have been replaced by an Object.keys). Probably worse than a bump
allocator and an implicit free of the nursery of a generational garbage
collector.
David
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss