#9875 closed task (fixed)
[cla/patch] dijit.WidgetSet - faster toArray() method
Reported by: | Les | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Dijit | Version: | 1.3.2 |
Keywords: | dijit.WidgetSet | Cc: | |
Blocked By: | Blocking: |
Description
This simple change results in 2x speed improvement in some browsers.
toArray: function() { var ar = []; for(id in this._hash){ arry.push(this._hash[id]); } return ar; }
The current code calls an anonymous function on each iteration.
toArray: function(){ var ar = []; this.forEach(function(w){ ar.push(w); // ^ i, ar[i] = w; }); return ar; // Array }
Change History (7)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Component: | General → Dijit |
---|---|
Keywords: | dijit.WidgetSet added; ijit.WidgetSet removed |
Owner: | anonymous deleted |
That's true, although I didn't think many people were using toArray(). But I guess it's worth the change. See also #4122.
comment:3 Changed 11 years ago by
dijit.WidgetSet?.filter() should also be converted to a for loop. This method is used quite often.
comment:4 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|---|
Owner: | set to bill |
Status: | new → assigned |
BTW where is filter() used? I can't think of anyone using it offhand but maybe there are plades.
comment:6 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 Changed 11 years ago by
Type: | enhancement → task |
---|
seems like these aren't really enhancements from the users' point of view, labeling as tasks instead
Note: See
TracTickets for help on using
tickets.
Fixed typo