Global Feed Post Login
Replying to Avatar Vitor Pamplona

Android coding is a constant reminder of how much performance relies on you knowing the exact inner workings of your environment:

Today's case: `array.toList()` is 4x(!!) slower than `listOf(array)` to return exactly the same thing.

But don't worry, there is also `array.asList()`, which is just 2x slower and `Arrays.asList` which is slighly faster than `listOf`.

This is not confusing at all.

Avatar
Alan Siefert 1y ago

I heard in some ECS/data-driven-design lessons for game design that it’s generally faster to have structs of arrays than arrays of structs. Perhaps it’s the same thing here?

Reply to this note

Please Login to reply.

Discussion

No replies yet.