Skip to content

Instantly share code, notes, and snippets.

@psiska
Last active December 16, 2015 22:39
Show Gist options
  • Save psiska/5508990 to your computer and use it in GitHub Desktop.
Save psiska/5508990 to your computer and use it in GitHub Desktop.
OrientDB ScalaMeter example
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
import com.orientechnologies.orient.core.record.impl.ODocument
import org.scalameter.api._
object DBTest extends PerformanceTest.Quickbenchmark {
import OUtils._ //custom DB helper - setups the database
val sequence = Gen.range("sequence")(0, 10, 1)
val names = Gen.enumeration("names")("ferko", "jozko", "duri", "alica", "betar", "kuchar", "lopata", "kon")
val recs = for {
seqid <- sequence
name <- names
} yield (seqid, name)
var dbcon = _
performance of "OrientDB" in {
measure method "insert" in {
using(recs) setUpBeforeAll{
prepareDB //creates the db in filesystem
dbcon = openDB //opens the db for use
} tearDownAfterAll {
dbcon.drop
dbcon.close
} in {
tup => new ODocument("perftest").field("myid", i).field("id", tup._1).field("sample", tup._2).save
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment