Opened 14 years ago

Closed 14 years ago

#6919 closed enhancement (fixed)

[patch]performance tweaks for dojo/_base/array.js

Reported by: Michael Schall Owned by: dylan
Priority: high Milestone: 1.2
Component: Core Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:


I looked though the style guide for "for" loops and could not find the suggested way. I looked at the _base/array.js for the best way. There were several differences within this file for each "for" statement. I searched google a little to find the "best" way. Looks like caching the length is superior and that ++i is better than i++. Premature optimization is bad, but I would think anything in _base needs to be as fast as possible. I'll include a patch for _base/array.js.


Attachments (1)

array.patch (1.4 KB) - added by guest 14 years ago.

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by guest

Attachment: array.patch added

comment:1 Changed 14 years ago by Adam Peller

Owner: changed from anonymous to alex
Reporter: changed from guest to Michael Schall

Could be premature optimization, but seems reasonable enough. It would be good to see a benchmark which shows a performance improvement with this patch.

comment:2 Changed 14 years ago by Adam Peller

Summary: Style guide for "for" loops[patch]performance tweaks for dojo/_base/array.js

comment:3 Changed 14 years ago by dylan

Milestone: 1.2
Owner: changed from alex to dylan
Status: newassigned

comment:4 Changed 14 years ago by dylan

Resolution: fixed
Status: assignedclosed

(In [14298]) fixes #6919, performance optimizations in array loop code, thanks schallm

Note: See TracTickets for help on using tickets.