[ruby-cvs:78995] e5c441a4a2 (master): Optimize Array#rotate!(n) for n = 1 and n = -1
"Ary Borenszweig" <[email protected]> Sun, 29 Dec 2019 13:12:53 +0900 (JST)
| Newsgroups | gmane.comp.lang.ruby.cvs |
|---|---|
| Message-ID | <[email protected]> |
Ary Borenszweig 2019-11-30 05:59:47 +0900 (Sat, 30 Nov 2019)
New Revision: e5c441a4a2
https://github.com/ruby/ruby/commit/e5c441a4a2
Log:
Optimize Array#rotate!(n) for n = 1 and n = -1
For the most common cases of `rotate!` one place to the right or to the
left, instead of doing some reversals of the array we just keep a single
value in a temporary value, use memmove and then put the temporary
value where it should be.
Modified files:
array.c