ruby/ruby — pull request #174 by funny-falcon (2012-09-02 12:21:08+00:00)
Title: Fix array behaviour when it is used as a queue

When array is used intensively as a queue (ie repeated `push`/`shift` calls), then its performance degrades very quickly with array's size (especially when almost every `shift` is followed be `push`), cause each `push` which is called after `shift` leads to allocation of new memory space and copying all items to.

This pull request fixes it in following way:
- reuse shared array's storage when array is a single owner of shared array.
- try to push items directly into shared array when array is a single owner of shared array
- try to unshift items directly into shared array when array is a single owner (and allocate room for futher unshifts)