game memory pressure test
This commit is contained in:
parent
8d4bbb2b05
commit
2800d4278f
|
@ -45,5 +45,6 @@ private[api] final class Cli(bus: lila.common.Bus) extends lila.common.Cli {
|
|||
lila.coach.Env.current.cli.process orElse
|
||||
lila.evalCache.Env.current.cli.process orElse
|
||||
lila.report.Env.current.cli.process orElse
|
||||
lila.game.Env.current.cli.process orElse
|
||||
process
|
||||
}
|
||||
|
|
|
@ -99,6 +99,12 @@ final class Env(
|
|||
lazy val stream = new GameStream(system)
|
||||
|
||||
lazy val bestOpponents = new BestOpponents
|
||||
|
||||
def cli = new lila.common.Cli {
|
||||
def process = {
|
||||
case "stream" :: "test" :: Nil => StreamTest.start
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Env {
|
||||
|
|
23
modules/game/src/main/StreamTest.scala
Normal file
23
modules/game/src/main/StreamTest.scala
Normal file
|
@ -0,0 +1,23 @@
|
|||
package lila.game
|
||||
|
||||
import BSONHandlers._
|
||||
import lila.db.dsl._
|
||||
import play.api.libs.iteratee._
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
object StreamTest {
|
||||
|
||||
val max = 100000
|
||||
|
||||
def start = {
|
||||
GameRepo.coll
|
||||
.find($empty)
|
||||
.cursor[Game]()
|
||||
.enumerator(max) |>>>
|
||||
Iteratee.fold[Game, Int](0) {
|
||||
case (nb, g) =>
|
||||
if (nb % 10000 == 0) println(nb)
|
||||
nb + 1
|
||||
} map (_.toString)
|
||||
}.chronometer.pp("##################")
|
||||
}
|
Loading…
Reference in a new issue