Skip to content

Commit

Permalink
I really need to stop calling size on iterators, it is the path of sa…
Browse files Browse the repository at this point in the history
…dness.
  • Loading branch information
holdenk committed Apr 8, 2014
1 parent b1ae51a commit 71e8b9f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bagel/src/main/scala/org/apache/spark/bagel/Bagel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ object Bagel extends Logging {
var numActiveVerts = sc.accumulator(0)
val processed = grouped.flatMapValues {
case (_, vs) if !vs.hasNext => None
case (c, vs) =>
case (c, vs) => {
val (newVert, newMsgs) =
compute(vs.next,
c.size match {
case 1 => Some(c.next)
case _ => None
c.hasNext match {
case true => Some(c.next)
case false => None
}
)

Expand All @@ -243,6 +243,7 @@ object Bagel extends Logging {
}

Some((newVert, newMsgs))
}
}.persist(storageLevel)

// Force evaluation of processed RDD for accurate performance measurements
Expand Down

0 comments on commit 71e8b9f

Please sign in to comment.