Skip to content

Commit dcecfad

Browse files
committed
Call System.gc for each iteration
1 parent 3e31ec5 commit dcecfad

File tree

1 file changed

+9
-4
lines changed
  • benchmark/src/jmh/scala/com/thoughtworks/deeplearning/benchmark

1 file changed

+9
-4
lines changed

benchmark/src/jmh/scala/com/thoughtworks/deeplearning/benchmark/benchmark.scala

+9-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ object benchmark {
4242
@State(Scope.Benchmark)
4343
class FourLayer {
4444

45-
@Param(Array("4"))
45+
@Param(Array("8"))
4646
protected var batchSize: Int = _
4747

4848
@Param(Array("1", "2", "4"))
@@ -170,10 +170,15 @@ object benchmark {
170170

171171
@Benchmark
172172
final def deepLearningDotScala(): Double = {
173-
val (coarseClass, batch) = batches.synchronized {
174-
batches.next()
173+
try {
174+
val (coarseClass, batch) = batches.synchronized {
175+
batches.next()
176+
}
177+
model.train(coarseClass, batch).blockingAwait
178+
} finally {
179+
System.gc()
180+
System.gc()
175181
}
176-
model.train(coarseClass, batch).blockingAwait
177182
}
178183

179184
}

0 commit comments

Comments
 (0)