game memory pressure test

This commit is contained in:
Thibault Duplessis 2018-02-06 08:37:09 -05:00
parent 8d4bbb2b05
commit 2800d4278f
3 changed files with 30 additions and 0 deletions

View file

@ -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
}

View file

@ -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 {

View 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("##################")
}