in reply to As Efficient as Possible

If you want good answers, please provide a short benchmark code, including samples of input data that are typical for your application.

One way to speed up your program is to get rid of @union, you just write to it but never read from it.

Perl 6 - links to (nearly) everything that is Perl 6.