https://github.com/doochik/uglify-array-plainize
UglifyJS plugin to convert modern array methods (forEach, map, filter) to plain JS for-loop
https://github.com/doochik/uglify-array-plainize
Last synced: over 1 year ago
JSON representation
UglifyJS plugin to convert modern array methods (forEach, map, filter) to plain JS for-loop
- Host: GitHub
- URL: https://github.com/doochik/uglify-array-plainize
- Owner: doochik
- Created: 2013-06-03T08:52:46.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-06-07T04:49:46.000Z (about 13 years ago)
- Last Synced: 2025-03-06T15:51:10.041Z (over 1 year ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
uglify-array-plainize
=====================
[UglifyJS](https://github.com/mishoo/UglifyJS2) plugin to convert modern array methods (forEach, map, filter) to plain JS for-loop
It's just an experiment.
The main reason is that native array methods are [slower than for-loop](http://jsperf.com/for-loop-vs-foreach-vs-reduce/3). So if you need extremely fast JS code you should avoid to use it.
There are many examples in `test` path.
For example,
```js
a.forEach(function(myValue) {
console.log(myValue);
});
```
converted to
```js
(function(ugAP_array_reference) {
for (var ugAP_iterator = 0, ugAP_array_length = ugAP_array_reference.length; ugAP_iterator < ugAP_array_length; ugAP_iterator++) {
var myValue = ugAP_array_reference[ugAP_iterator];
console.log(myValue);
}
})(a);
```