| Class | God::Timeline |
| In: |
lib/god/timeline.rb
|
| Parent: | Array |
Push a value onto the Timeline
Implementation explanation: A performance optimization appears here to speed up the push time. In essence, the code does this:
def push(val)
super(val)
shift if size > @max_size
end
But that‘s super slow due to the shift, so we resort to reverse! and pop which gives us a 2x speedup with 100 elements and a 6x speedup with 1000