mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #648 from RyanScottLewis/master
Slightly faster Array#each method.
This commit is contained in:
+3
-5
@@ -10,11 +10,9 @@ class Array
|
||||
#
|
||||
# ISO 15.2.12.5.10
|
||||
def each(&block)
|
||||
idx = 0
|
||||
while(idx < length)
|
||||
block.call(self[idx])
|
||||
idx += 1
|
||||
end
|
||||
idx, length = -1, self.length-1
|
||||
block.call(self[idx += 1]) while(idx < length)
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user