atom / language-javascript

JavaScript language package for Atom
Other
194 stars 236 forks source link

improve (for) loop #637

Closed Ali-00-Ridha closed 5 years ago

Ali-00-Ridha commented 5 years ago

Requirements

Description of the Change

fixes #637. improve for loop structure to improve performance as the new for loop structure reads the array length only one time instead of the old structure which read the array length on every iterate.

new for loop structure:

for (var i = array.length; i >= 0; i--) { array[i]; }

Alternate Designs

there is no alternatives

Benefits

improve for loop structure by reading the array length only one time instead of reading array length on every iterate.

Possible Drawbacks

maybe it's the new structure has harder readability than the old structure.

Applicable Issues

improve loop performance

Arcanemagus commented 5 years ago

Thank you very much for the contribution!

We generally don't accept modifications for snippets in the language packages since they are easily overridden and we expect that people will do so for their own purposes. You can find instructions on how to create your own snippets in the Flight Manual. Viewing a language package that provides snippets allows you to copy the current version as a starting place for creating your own.

Thanks for the suggestion but we're going to leave things as they are for now unless the current snippet produces invalid code.