Last active
April 16, 2018 12:50
-
-
Save XingMXTeam/573f33c7de873166534d8643bda74af9 to your computer and use it in GitHub Desktop.
another Array.splice implement which is 1.5x faster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function spliceOne(list, index) { | |
| for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) | |
| list[i] = list[k]; | |
| list.pop(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment