Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ target
obj
__pycache__
.metals
.bloop
.bloop
.idea
.bsp
27 changes: 20 additions & 7 deletions benchmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@
run:
cmd: node
args: ["index.js"]
- id: nim-graphql
name: nim-graphql
url: https://github.com/status-im/nim-graphql
lang: Nim
server: Chronos
run:
cmd: ./main
#- id: nim-graphql
# name: nim-graphql
# url: https://github.com/status-im/nim-graphql
# lang: Nim
# server: Chronos
# run:
# cmd: ./main
- id: graphql-ruby
name: graphql-ruby
url: https://github.com/rmosolgo/graphql-ruby
Expand Down Expand Up @@ -217,3 +217,16 @@
args:
- start
- ./main.graphql
- id: caliban
name: Caliban
url: https://ghostdogpr.github.io/caliban/
lang: Scala
server: ZIO Http
run:
cmd: java
args:
[
"-Xmx4G",
"-jar",
"./target/scala-3.4.1/caliban-assembly-0.1.0-SNAPSHOT.jar",
]
5 changes: 5 additions & 0 deletions caliban/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version = "3.7.14"
runner.dialect = "scala3"

align.preset = more
maxColumn = 120
14 changes: 14 additions & 0 deletions caliban/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name := "caliban"
scalaVersion := "3.4.1"

assembly / mainClass := Some("Main")

assembly / assemblyMergeStrategy := {
case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.first
case x => MergeStrategy.first
}

libraryDependencies ++= Seq(
"com.github.ghostdogpr" %% "caliban-quick" % "2.6.0"
)
1 change: 1 addition & 0 deletions caliban/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version = 1.9.7
1 change: 1 addition & 0 deletions caliban/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.4")
18 changes: 18 additions & 0 deletions caliban/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import caliban.*
import caliban.quick.*
import caliban.schema.Schema
import zio.*

case class Query(hello: String) derives Schema.SemiAuto

object Main extends ZIOAppDefault {
override val bootstrap: ZLayer[ZIOAppArgs, Any, Any] =
ZLayer.make[Any](
Runtime.setExecutor(Executor.makeDefault(false)),
ZLayer.scoped(ZIO.withRuntimeFlagsScoped(RuntimeFlags.disable(RuntimeFlag.FiberRoots)))
)

private val api = graphQL(RootResolver(Query("world")))

def run = ZIO.yieldNow *> api.runServer(8000, "/graphql")
}
13 changes: 8 additions & 5 deletions run.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ benchmarks.map do |b|
run("bundle", ["install", "--quiet"], dir, true) if File.exists? dir.join("Gemfile")
run("mix", ["deps.get", "--only", "prod"], dir, true) if File.exists? dir.join("mix.exs")
run("mix", ["compile"], dir, true) if File.exists? dir.join("mix.exs")
run("nimble", ["--silent", "-y", "install"], dir, true) if File.exists? dir.join("main.nimble")
run("nimble", ["--silent", "-y", "build", "-d:release", "-d:chronicles_log_level=WARN"], dir, true) if File.exists? dir.join("main.nimble")
# run("nimble", ["--silent", "-y", "install"], dir, true) if File.exists? dir.join("main.nimble")
# run("nimble", ["--silent", "-y", "build", "-d:release", "-d:chronicles_log_level=WARN"], dir, true) if File.exists? dir.join("main.nimble")
run("dub", ["--quiet", "build", "-b=release"], dir, true) if File.exists? dir.join("dub.json")
ch.send(nil)
rescue ex
Expand Down Expand Up @@ -56,17 +56,20 @@ benchmarks.each_with_index do |b, i|
sleep 1
end

res = (0...1).map do |_|
res = (0...3).map do |_|
output = IO::Memory.new
run("bombardier", ["-c#{System.cpu_count * 50}", "-d5s", "-mPOST", %(-b{"query":"{ hello }"}), "-HContent-Type: application/json", "-ojson", "-pr", "http://localhost:8000/graphql"], wait: true, output: output)
sleep 1
output.to_s
end.last

p.terminate
r = p.wait
if r.exit_code != 0
puts "command failed with exit code #{r.exit_code}"
exit 1
if r.exit_code != 143
puts "command failed with exit code #{r.exit_code}"
exit 1
end
end

benchmarks[i].result = JSON.parse(res.split('\n').last)["result"]
Expand Down