develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33896 - trunk/languages/perl6/src/classes

From:
pmichaud
Date:
December 14, 2008 10:43
Subject:
[svn:parrot] r33896 - trunk/languages/perl6/src/classes
Message ID:
20081214184338.3080DCBA12@x12.develooper.com
Author: pmichaud
Date: Sun Dec 14 10:43:37 2008
New Revision: 33896

Modified:
   trunk/languages/perl6/src/classes/List.pir

Log:
[rakudo]: Optimize flattening a bit further.
When splicing in a flattened element, we don't need to
re-flatten the things we just spliced in.


Modified: trunk/languages/perl6/src/classes/List.pir
==============================================================================
--- trunk/languages/perl6/src/classes/List.pir	(original)
+++ trunk/languages/perl6/src/classes/List.pir	Sun Dec 14 10:43:37 2008
@@ -239,14 +239,18 @@
     $I0 = can elem, '!flatten'
     if $I0 goto flat_elem
     $I0 = does elem, 'array'
-    if $I0 goto flat_splice
+    unless $I0 goto flat_next
+    splice self, elem, i, 1
+    len = elements self
+    goto flat_loop
   flat_next:
     inc i
     goto flat_loop
   flat_elem:
     elem = elem.'!flatten'()
-  flat_splice:
     splice self, elem, i, 1
+    $I0 = elements elem
+    i += $I0
     len = elements self
     goto flat_loop
   flat_end:



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About