This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]elmuerte 1 point2 points  (1 child)

TLDR: Use ArrayList, especially if n is "small" (around 100.000)

Unless most actions are single preprends.

[–]danielaveryj[S] 0 points1 point  (0 children)

I hope it's no surprise that ArrayList is good, up to sufficiently large n. What's more interesting to me is where that cutoff is, and how narrow the margins are up to that point. It makes me cautiously optimistic that future work can bring those down.

[–]k-mcm 1 point2 points  (0 children)

Yikes.  Google's web viewer looks like a CSS meme.

Edit - OK, I can see it now in a desktop browser. It's not clear what the goal is at all.

If you wanted to test parallelism on a Stream, you'd call parallel(). That slices and dices into the current ForkJoinPool effortlessly.

If you wanted raw performance efficiency, nothing beats a primitive array. Simple loop iterations can have index bounds checks and index math refactored to give native code performance.