I encountered performance problems. Currently I use unshift method to add items to the beginning of the buffer. But it seems there is more efficient way.
It is more appropriate to ask: what is the most efficient way to add items to an array (no matter, in the beginning or in the end)?
I encountered performance problems. Currently I use unshift method to add items to the beginning of the buffer. But it seems there is more efficient way.
It is more appropriate to ask: what is the most efficient way to add items to an array (no matter, in the beginning or in the end)?[/QUOTE]
i posted it...
it's quicker to go to the end, since adding to the front requires re-indexing the whole array...
it a tightly controlled situation, you can get a 1-3% boost by using "++":