Skip to content

Commit

Permalink
Fix GatherIter not to add a frame every take.
Browse files Browse the repository at this point in the history
Fixes the typical case of StackOverflowException on the JVM, and leads
to far better gather/take performance on both MoarVM and JVM.
  • Loading branch information
jnthn committed Jan 19, 2014
1 parent 7b540cc commit 8c054a4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/GatherIter.pm
Expand Up @@ -17,9 +17,7 @@ class GatherIter is Iterator {
my Mu $takings;
my Mu $state;
my sub yield() {
nqp::continuationcontrol(0, $GATHER_PROMPT, -> Mu \c {
$state := sub () is rw { nqp::continuationinvoke(c, -> | { Nil }); };
});
nqp::continuationcontrol(0, $GATHER_PROMPT, -> Mu \c { $state := c; });
}
$state := sub () is rw {
nqp::handle( $block().eager(),
Expand Down

0 comments on commit 8c054a4

Please sign in to comment.