-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
120 additions
and
26 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...arks/src/main/scala/org/broadinstitute/dsde/firecloud/utils/TsvFileSupportBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.broadinstitute.dsde.firecloud.utils | ||
|
||
import org.broadinstitute.dsde.firecloud.model.{EntityUpdateDefinition, FlexibleModelSchema, ModelSchema} | ||
import org.broadinstitute.dsde.firecloud.service.TSVFileSupport | ||
import org.broadinstitute.dsde.firecloud.utils.TsvFileSupportBenchmark.TsvData | ||
import org.openjdk.jmh.annotations.{Benchmark, Scope, State} | ||
import org.openjdk.jmh.infra.Blackhole | ||
|
||
object TsvFileSupportBenchmark { | ||
@State(Scope.Thread) | ||
class TsvData { | ||
val entityType: String = "sample" | ||
val memberTypeOpt: Option[String] = None | ||
// representation of the inbound TSV row | ||
val row: Seq[String] = Seq( | ||
"0005", | ||
"foo", | ||
"\"some\tquoted\tvalue\"", | ||
"42", | ||
"true", | ||
"-123.456", | ||
"gs://some-bucket/somefile.ext", | ||
"""{"entityType":"targetType", "entityName":"targetName"}""", | ||
"[1,2,3,4,5]" | ||
) | ||
val colInfo: Seq[(String, Option[String])] = Seq( | ||
("sample_id", None), | ||
("string", None), | ||
("quotedstring", None), | ||
("int", None), | ||
("boolean", None), | ||
("double", None), | ||
("file", None), | ||
("reference", None), | ||
("array", None) | ||
) | ||
val modelSchema: ModelSchema = FlexibleModelSchema | ||
val deleteEmptyValues: Boolean = false | ||
} | ||
} | ||
|
||
class TsvFileSupportBenchmark { | ||
|
||
@Benchmark | ||
def makeEntityRows(blackHole: Blackhole, tsvData: TsvData): EntityUpdateDefinition = { | ||
|
||
val result: EntityUpdateDefinition = TsvFileSupportHarness.setAttributesOnEntity(tsvData.entityType, | ||
tsvData.memberTypeOpt, | ||
tsvData.row, | ||
tsvData.colInfo, | ||
tsvData.modelSchema, | ||
tsvData.deleteEmptyValues | ||
) | ||
blackHole.consume(result) | ||
result | ||
} | ||
|
||
} | ||
|
||
// helper object to get access to TSVFileSupport trait | ||
object TsvFileSupportHarness extends TSVFileSupport {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters