On Tuesday, 26 January 2021 at 23:57:43 UTC, methonash wrote:
Using AA's may not necessarily improve performance. It
depends on what your code does with it. Because AA's require
random access to memory, it's not friendly to the CPU cache
hierarchy, whereas traversing linear arrays is more
cache-friendly and in some cases will out-perform AA's.
I figured a built-in AA might be an efficient path to
performing unique string de-duplication. If there's a more
performant method available, I'll certainly try it.
You could try sorting the array first, and then using `uniq` [1]
to discard duplicate elements. There's an example in the docs
that shows how to do this in-place (without allocating additional
memory).
[1] http://phobos.dpldocs.info/std.algorithm.iteration.uniq.html