mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
parent
393893a601
commit
0374843143
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
load(
|
load(
|
||||||
"//bazel_tools:scala.bzl",
|
"//bazel_tools:scala.bzl",
|
||||||
|
"da_scala_benchmark_jmh",
|
||||||
"da_scala_library",
|
"da_scala_library",
|
||||||
"da_scala_test",
|
"da_scala_test",
|
||||||
"da_scala_test_suite",
|
"da_scala_test_suite",
|
||||||
@ -107,3 +108,29 @@ scala_repl(
|
|||||||
":interpreter",
|
":interpreter",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
da_scala_benchmark_jmh(
|
||||||
|
name = "speedy-compilation-benchmark",
|
||||||
|
srcs = glob(["src/bench/**/*.scala"]),
|
||||||
|
data = [
|
||||||
|
"//ledger/test-common:model-tests-1.14.dar",
|
||||||
|
],
|
||||||
|
scala_deps = [
|
||||||
|
"@maven//:org_scalaz_scalaz_core",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [
|
||||||
|
"//bazel_tools/runfiles:scala_runfiles",
|
||||||
|
"//daml-lf/archive:daml_lf_archive_reader",
|
||||||
|
"//daml-lf/archive:daml_lf_dev_archive_proto_java",
|
||||||
|
"//daml-lf/data",
|
||||||
|
"//daml-lf/engine",
|
||||||
|
"//daml-lf/interpreter",
|
||||||
|
"//daml-lf/language",
|
||||||
|
"//daml-lf/scenario-interpreter",
|
||||||
|
"//daml-lf/transaction",
|
||||||
|
"//daml-lf/validation",
|
||||||
|
"//ledger/test-common:dar-files-default-lib",
|
||||||
|
"@maven//:com_google_protobuf_protobuf_java",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package com.daml.lf.speedy
|
||||||
|
|
||||||
|
import com.daml.bazeltools.BazelRunfiles.rlocation
|
||||||
|
import com.daml.ledger.test.ModelTestDar
|
||||||
|
import com.daml.lf.archive.DarDecoder
|
||||||
|
import com.daml.lf.archive.Dar
|
||||||
|
import com.daml.lf.data.Ref.PackageId
|
||||||
|
import com.daml.lf.language.Ast.Package
|
||||||
|
import com.daml.lf.language.PackageInterface
|
||||||
|
import com.daml.lf.speedy
|
||||||
|
import java.io.File
|
||||||
|
import org.openjdk.jmh.annotations.{Param, Setup, Level, Benchmark, State, Scope}
|
||||||
|
|
||||||
|
@State(Scope.Benchmark)
|
||||||
|
class SpeedyCompilation {
|
||||||
|
|
||||||
|
@Param(Array(""))
|
||||||
|
var darPath: String = _
|
||||||
|
|
||||||
|
private var dar: Dar[(PackageId, Package)] = _
|
||||||
|
private var darMap: Map[PackageId, Package] = _
|
||||||
|
private var interface: PackageInterface = _
|
||||||
|
|
||||||
|
@Setup(Level.Trial)
|
||||||
|
def setup(): Unit = {
|
||||||
|
val darFile = new File(
|
||||||
|
if (darPath.isEmpty)
|
||||||
|
rlocation(ModelTestDar.path)
|
||||||
|
else darPath
|
||||||
|
)
|
||||||
|
dar = DarDecoder.assertReadArchiveFromFile(darFile)
|
||||||
|
darMap = dar.all.toMap
|
||||||
|
interface = PackageInterface(darMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def bench(): Unit = {
|
||||||
|
val config = speedy.Compiler.Config.Default
|
||||||
|
val res = speedy.Compiler.compilePackages(interface, darMap, config)
|
||||||
|
assert(res.isRight)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user