Ticket #6919 (closed enhancement: fixed)

Opened 3 months ago

Last modified 7 weeks ago

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

Reported by: schallm Owned by: dylan
Priority: normal Milestone: 1.2
Component: Core Version: 1.1.1
Severity: normal Keywords:
Cc:

Description

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.

schallm

Attachments

array.patch (1.4 kB) - added by guest 3 months ago.

Change History

Changed 3 months ago by guest

Changed 3 months ago by peller

  • owner changed from anonymous to alex
  • reporter changed from guest to schallm

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

Changed 3 months ago by peller

  • summary changed from Style guide for "for" loops to [patch]performance tweaks for dojo/_base/array.js

Changed 7 weeks ago by dylan

  • owner changed from alex to dylan
  • status changed from new to assigned
  • milestone set to 1.2

Changed 7 weeks ago by dylan

  • status changed from assigned to closed
  • resolution set to fixed

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

Note: See TracTickets for help on using tickets.