You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
users = enumerable(users) will work, I do this in the tests a lot, returns an Enumerable with the array as .obj as a wrapper. the wrapper is for the same reason as Emitter, more efficient than doing a one-of mixin
i havent bothered to benchmark it but it's a large difference considering you're adding one prop, or adding ~40 each time and v8 can't inline the lookups etc.
yeah it's definitely annoying, prototypes and inheritance are very flawed at best, we could maybe have a higher-level enumerable array thing that just hides the array inside but still has .push etc, kinda like https://github.com/component/collection/blob/master/index.js
unfortunately with how js is structured you more or less cannot cleanly extend things, just a language-level flaw, but almost every language does the same dumb things :(
Activity
tj commentedon Nov 8, 2012
users = enumerable(users)will work, I do this in the tests a lot, returns an Enumerable with the array as.objas a wrapper. the wrapper is for the same reason as Emitter, more efficient than doing a one-of mixinmatthewmueller commentedon Nov 8, 2012
Hmm, do you happen to have any stats/links on performance differences?
In this example you'd have to do
users.value().push(matt, jim);which is something found really annoying about working with backbone's collections.tj commentedon Nov 8, 2012
i havent bothered to benchmark it but it's a large difference considering you're adding one prop, or adding ~40 each time and v8 can't inline the lookups etc.
yeah it's definitely annoying, prototypes and inheritance are very flawed at best, we could maybe have a higher-level enumerable array thing that just hides the array inside but still has .push etc, kinda like https://github.com/component/collection/blob/master/index.js
tj commentedon Nov 8, 2012
unfortunately with how js is structured you more or less cannot cleanly extend things, just a language-level flaw, but almost every language does the same dumb things :(