Divec has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315196

Change subject: Optimize batchPush on small lists
......................................................................

Optimize batchPush on small lists

Doubles the speed of ve.batchPush( [], [ 1, 2, 3, 4, 5 ] ) on Chromium

Change-Id: I187381a3c5dfaed536f15195630365721728bb76
---
M src/ve.utils.js
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/96/315196/1

diff --git a/src/ve.utils.js b/src/ve.utils.js
index d59da58..013d85a 100644
--- a/src/ve.utils.js
+++ b/src/ve.utils.js
@@ -316,6 +316,10 @@
        var length,
                index = 0,
                batchSize = 1024;
+       if ( batchSize >= data.length ) {
+               // Avoid slicing for small lists
+               return arr.push.apply( arr, data );
+       }
        while ( index < data.length ) {
                // Call arr.push( i0, i1, i2, ..., i1023 );
                length = arr.push.apply(

-- 
To view, visit https://gerrit.wikimedia.org/r/315196
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I187381a3c5dfaed536f15195630365721728bb76
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec <da...@troi.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to