I'm not sure if my patch went through so here it is pasted in the body:

================Patch Start============================

>From a52831f6d0bc3ce736de154756a4fad5c2c22eb2 Mon Sep 17 00:00:00 2001
From: Z. Bornheimer <z...@chary.me>
Date: Sat, 8 Dec 2012 09:59:37 -0500
Subject: [PATCH 1/2] Decreased memory usage of uniq

---
 src/core/List.pm |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/core/List.pm b/src/core/List.pm
index ad8d6a7..b89b3d2 100644
--- a/src/core/List.pm
+++ b/src/core/List.pm
@@ -314,19 +314,17 @@ my class List does Positional {
     # other than the stringification of the objects.
     method uniq() {
         my %seen;
-        gather for @.list {
-             unless %seen{$_} {
-                 take $_;
-                 %seen{$_} = 1;
-             }
+        for @.list {
+            %seen{$_} = 1;
         }
+        return %seen.keys;
     }

     multi method gist(List:D:) { self.Str }
     multi method perl(List:D \SELF:) {
         self.gimme(*);
         self.Parcel.perl ~ '.list'
-          ~ (nqp::iscont(SELF) ?? '.item' !! '')
+            ~ (nqp::iscont(SELF) ?? '.item' !! '')
     }

     method REIFY(Parcel \parcel, Mu \nextiter) {
-- 
1.7.1



================Patch End============================


## Z. Bornheimer


On Sat, Dec 8, 2012 at 12:29 PM, perl6 via RT
<perl6-bugs-follo...@perl.org>wrote:

> Greetings,
>
> This message has been automatically generated in response to the
> creation of a trouble ticket regarding:
>         "[BUG] uniq uses too much memory and is redundant in operations",
> a summary of which appears below.
>
> There is no need to reply to this message right now.  Your ticket has been
> assigned an ID of [perl #116024].
>
> Please include the string:
>
>          [perl #116024]
>
> in the subject line of all future correspondence about this issue. To do
> so,
> you may reply to this message.
>
>                         Thank you,
>                         perl6-bugs-follo...@perl.org
>
> -------------------------------------------------------------------------
> I have been testing uniq on lists with 100K+ of elements on low memory
> systems.  This patch for uniq greatly decreases memory usage.
>
> ## Z. Bornheimer
>
>

Reply via email to