> LL copy is fairly slow and likely loses us any gains. Also, I'm a little
> dubious on the use of LL given that we support a replaceAtIndex which will
> be much faster in an array.
> 
> Can we improve by using an ArrayDeque?
Does ArrayDeque support to change element by arbitrary index? If not, it not 
easy to change the impl by one line since the replaceAtIndex() need to change 
the element in pipeline.

BTW, could we change the impl of "readOnlyCopy" from LinkedList to ArrayList? 
Most ops to  readOnlyCopy are iteration, and the getLast can be replaced by 
size() and get(index). 

On 2018/03/10 20:12:01, Mike Drob <mad...@cloudera.com> wrote: 
> Hi devs,
> 
> I was reading through HBASE-17434 trying to understand why we have two
> linked lists in compaction pipeline and I'm having trouble following the
> conversation there, especially since it seems intertwined with HBASE-17379
> and jumps back and forth a few times.
> 
> It looks like we are implementing our own copy-on-write list, and there is
> a claim that addFirst is faster on a LinkedList than an array based list. I
> am concerned about the LL copy in pushHead - even if addFirst is faster, a
> LL copy is fairly slow and likely loses us any gains. Also, I'm a little
> dubious on the use of LL given that we support a replaceAtIndex which will
> be much faster in an array.
> 
> Can we improve by using an ArrayDeque?
> 
> Eschar, Anastasia, WDYT?
> 
> Thanks,
> Mike
> 
> Some observations about performance -
> https://stuartmarks.wordpress.com/2015/12/18/some-java-list-benchmarks/
> 

Reply via email to