diff --git a/perf/impl/Makefile b/perf/impl/Makefile index f7474f8..e274d58 100644 --- a/perf/impl/Makefile +++ b/perf/impl/Makefile @@ -2,8 +2,9 @@ GO_SUBDIRS := $(wildcard go-libp2p/*/.) RUST_SUBDIRS := $(wildcard rust-libp2p/*/.) HTTPS_SUBDIRS := $(wildcard https/*/.) QUIC_GO_SUBDIRS := $(wildcard quic-go/*/.) +JS_SUBDIRS := $(wildcard js-libp2p/*/.) -all: $(RUST_SUBDIRS) $(GO_SUBDIRS) $(HTTPS_SUBDIRS) $(QUIC_GO_SUBDIRS) +all: $(RUST_SUBDIRS) $(GO_SUBDIRS) $(HTTPS_SUBDIRS) $(QUIC_GO_SUBDIRS) $(JS_SUBDIRS) $(RUST_SUBDIRS): $(MAKE) -C $@ $(GO_SUBDIRS): @@ -12,10 +13,12 @@ $(HTTPS_SUBDIRS): $(MAKE) -C $@ $(QUIC_GO_SUBDIRS): $(MAKE) -C $@ +$(JS_SUBDIRS): + $(MAKE) -C $@ -clean: $(RUST_SUBDIRS:%=%clean) $(GO_SUBDIRS:%=%clean) $(HTTPS_SUBDIRS:%=%clean) $(QUIC_GO_SUBDIRS:%=%clean) +clean: $(RUST_SUBDIRS:%=%clean) $(GO_SUBDIRS:%=%clean) $(HTTPS_SUBDIRS:%=%clean) $(QUIC_GO_SUBDIRS:%=%clean) $(JS_SUBDIRS:%=%clean) %clean: $(MAKE) -C $* clean -.PHONY: $(RUST_SUBDIRS) $(GO_SUBDIRS) $(HTTPS_SUBDIRS) $(QUIC_GO_SUBDIRS) all clean +.PHONY: $(RUST_SUBDIRS) $(GO_SUBDIRS) $(HTTPS_SUBDIRS) $(QUIC_GO_SUBDIRS) $(JS_SUBDIRS) all clean diff --git a/perf/impl/js-libp2p/.gitignore b/perf/impl/js-libp2p/.gitignore new file mode 100644 index 0000000..23a7744 --- /dev/null +++ b/perf/impl/js-libp2p/.gitignore @@ -0,0 +1,3 @@ +js-libp2p-*.zip +js-libp2p-* +js-libp2p-*/* diff --git a/perf/impl/js-libp2p/v0.46/Makefile b/perf/impl/js-libp2p/v0.46/Makefile new file mode 100644 index 0000000..e585460 --- /dev/null +++ b/perf/impl/js-libp2p/v0.46/Makefile @@ -0,0 +1,19 @@ +NPM_PACKAGE_VERSION := 1.1.1 +NPM_PACKAGE := @libp2p/perf +NPM_PACKAGE_NAME := $(NPM_PACKAGE)@$(NPM_PACKAGE_VERSION) + +SOURCE_DIR := js-libp2p-protocol-perf + +DOCKER_IMAGE := node:18.17.1 +DOCKER_RUN := docker run --rm -v "$(shell pwd)/$(SOURCE_DIR)":/usr/src/myapp -w /usr/src/myapp $(DOCKER_IMAGE) + +all: perf + +perf: + mkdir -p $(SOURCE_DIR) + $(DOCKER_RUN) npm install $(NPM_PACKAGE_NAME) + +clean: + rm -rf js-libp2p-* + +.PHONY: all clean perf diff --git a/perf/impl/js-libp2p/v0.46/perf b/perf/impl/js-libp2p/v0.46/perf new file mode 100755 index 0000000..d9a6f63 --- /dev/null +++ b/perf/impl/js-libp2p/v0.46/perf @@ -0,0 +1,45 @@ +#!/bin/bash + +# In case this script is `kill`ed, `kill` its child process, namely the `node` +# process below. +cleanup() { + kill $node_pid +} +trap cleanup EXIT TERM + +# Find the path to the Node.js executable +node_path=$(which node) + +run_server=false +server_address="" +upload_bytes=0 +download_bytes=0 +transport="" + +# Parse named parameters manually +for ((i = 1; i <= $#; i++)); do + if [ "${!i}" == "--server-address" ]; then + server_address="${@:i+1:1}" + fi + if [ "${!i}" == "--upload-bytes" ]; then + upload_bytes="${@:i+1:1}" + fi + if [ "${!i}" == "--download-bytes" ]; then + download_bytes="${@:i+1:1}" + fi + if [ "${!i}" == "--transport" ]; then + transport="${@:i+1:1}" + fi + if [ "${!i}" == "--run-server" ]; then + run_server=true + fi +done + +# Run perf +node impl/js-libp2p/v0.46/js-libp2p-protocol-perf/node_modules/@libp2p/perf/dist/src/main.js --run-server=$run_server --server-address=$server_address --upload-bytes=$upload_bytes --download-bytes=$download_bytes --transport=$transport & + +node_pid=$! + +# Wait for `node_pid` to finish, or for it to be `kill`ed by the above +# `cleanup`. +wait $node_pid diff --git a/perf/runner/benchmark-results.json b/perf/runner/benchmark-results.json index 70c05f2..511af57 100644 --- a/perf/runner/benchmark-results.json +++ b/perf/runner/benchmark-results.json @@ -447,6 +447,43 @@ "implementation": "go-libp2p", "version": "v0.29", "transportStack": "quic-v1" + }, + { + "result": [ + { + "latency": 31.331 + }, + { + "latency": 31.331 + }, + { + "latency": 31.143 + }, + { + "latency": 31.302 + }, + { + "latency": 31.412 + }, + { + "latency": 31.184 + }, + { + "latency": 31.172 + }, + { + "latency": 31.208 + }, + { + "latency": 31.31 + }, + { + "latency": 31.252 + } + ], + "implementation": "js-libp2p", + "version": "v0.46", + "transportStack": "tcp" } ], "parameters": { @@ -901,6 +938,43 @@ "implementation": "go-libp2p", "version": "v0.29", "transportStack": "quic-v1" + }, + { + "result": [ + { + "latency": 31.359 + }, + { + "latency": 31.267 + }, + { + "latency": 31.327 + }, + { + "latency": 31.506 + }, + { + "latency": 31.255 + }, + { + "latency": 31.295 + }, + { + "latency": 31.348 + }, + { + "latency": 31.19 + }, + { + "latency": 31.307 + }, + { + "latency": 31.309 + } + ], + "implementation": "js-libp2p", + "version": "v0.46", + "transportStack": "tcp" } ], "parameters": { @@ -4595,6 +4669,313 @@ "implementation": "go-libp2p", "version": "v0.29", "transportStack": "quic-v1" + }, + { + "result": [ + { + "latency": 1.061 + }, + { + "latency": 1.003 + }, + { + "latency": 1.051 + }, + { + "latency": 0.996 + }, + { + "latency": 1.001 + }, + { + "latency": 1.061 + }, + { + "latency": 1.045 + }, + { + "latency": 1.036 + }, + { + "latency": 1.054 + }, + { + "latency": 1.05 + }, + { + "latency": 1.032 + }, + { + "latency": 1.05 + }, + { + "latency": 1.038 + }, + { + "latency": 1.042 + }, + { + "latency": 1.049 + }, + { + "latency": 1.003 + }, + { + "latency": 1.051 + }, + { + "latency": 1.034 + }, + { + "latency": 0.987 + }, + { + "latency": 1.061 + }, + { + "latency": 1.035 + }, + { + "latency": 1.039 + }, + { + "latency": 0.995 + }, + { + "latency": 1.056 + }, + { + "latency": 1.039 + }, + { + "latency": 1.037 + }, + { + "latency": 1.002 + }, + { + "latency": 0.998 + }, + { + "latency": 1.042 + }, + { + "latency": 1.059 + }, + { + "latency": 1.059 + }, + { + "latency": 1.022 + }, + { + "latency": 1.033 + }, + { + "latency": 1.06 + }, + { + "latency": 0.983 + }, + { + "latency": 0.982 + }, + { + "latency": 0.979 + }, + { + "latency": 1.04 + }, + { + "latency": 1.052 + }, + { + "latency": 1.002 + }, + { + "latency": 1.052 + }, + { + "latency": 1.051 + }, + { + "latency": 1.037 + }, + { + "latency": 1.038 + }, + { + "latency": 1.003 + }, + { + "latency": 1.037 + }, + { + "latency": 0.98 + }, + { + "latency": 1.005 + }, + { + "latency": 1.031 + }, + { + "latency": 1.042 + }, + { + "latency": 1.007 + }, + { + "latency": 1.059 + }, + { + "latency": 0.979 + }, + { + "latency": 1.034 + }, + { + "latency": 1.035 + }, + { + "latency": 0.994 + }, + { + "latency": 1.037 + }, + { + "latency": 1.035 + }, + { + "latency": 1.008 + }, + { + "latency": 1.059 + }, + { + "latency": 1.004 + }, + { + "latency": 1.05 + }, + { + "latency": 1.007 + }, + { + "latency": 1.053 + }, + { + "latency": 0.998 + }, + { + "latency": 0.987 + }, + { + "latency": 1.061 + }, + { + "latency": 0.98 + }, + { + "latency": 1.037 + }, + { + "latency": 0.996 + }, + { + "latency": 1.004 + }, + { + "latency": 1.026 + }, + { + "latency": 1.038 + }, + { + "latency": 1.038 + }, + { + "latency": 1.035 + }, + { + "latency": 1.031 + }, + { + "latency": 1.035 + }, + { + "latency": 1.004 + }, + { + "latency": 1.059 + }, + { + "latency": 1.004 + }, + { + "latency": 1.015 + }, + { + "latency": 1.053 + }, + { + "latency": 1.056 + }, + { + "latency": 1.055 + }, + { + "latency": 1.03 + }, + { + "latency": 1.053 + }, + { + "latency": 1.037 + }, + { + "latency": 1.001 + }, + { + "latency": 1.058 + }, + { + "latency": 1.056 + }, + { + "latency": 1.01 + }, + { + "latency": 1.058 + }, + { + "latency": 1.035 + }, + { + "latency": 1.063 + }, + { + "latency": 1.015 + }, + { + "latency": 1.036 + }, + { + "latency": 1.014 + }, + { + "latency": 1.015 + }, + { + "latency": 1.033 + }, + { + "latency": 1.04 + } + ], + "implementation": "js-libp2p", + "version": "v0.46", + "transportStack": "tcp" } ], "parameters": { @@ -4606,173 +4987,29 @@ "pings": { "unit": "s", "results": [ - 0.07490000000000001, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.06420000000000001, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.06459999999999999, - 0.0696, - 0.0696, - 0.0696, - 0.0696, - 0.0696, - 0.0696, - 0.0696, - 0.0696, - 0.0696, - 0.0696, - 0.06409999999999999, - 0.06420000000000001, - 0.06420000000000001, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0645, - 0.0643, - 0.06420000000000001, - 0.0643, - 0.06420000000000001, - 0.06420000000000001, - 0.0643, - 0.06420000000000001, - 0.0643, - 0.0643, - 0.06420000000000001, - 0.0643, - 0.06420000000000001, - 0.06420000000000001, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.0645, - 0.0643, - 0.0643, - 0.0643, - 0.06420000000000001, - 0.0643, - 0.06420000000000001, - 0.0643, - 0.0643, - 0.0643, - 0.06420000000000001, - 0.0643, - 0.0643, - 0.0643, - 0.0643, - 0.06420000000000001, - 0.06420000000000001, - 0.0643, - 0.06420000000000001, - 0.06420000000000001, - 0.0643, - 0.0643, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001, - 0.0643, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001, - 0.06459999999999999, - 0.0643, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001, - 0.06420000000000001 + 0.07490000000000001, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.06420000000000001, 0.0643, 0.0643, + 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.06459999999999999, 0.0696, + 0.0696, 0.0696, 0.0696, 0.0696, 0.0696, 0.0696, 0.0696, 0.0696, 0.0696, 0.06409999999999999, 0.06420000000000001, + 0.06420000000000001, 0.0643, 0.0643, 0.0643, 0.0643, 0.0643, 0.0645, 0.0643, 0.06420000000000001, 0.0643, + 0.06420000000000001, 0.06420000000000001, 0.0643, 0.06420000000000001, 0.0643, 0.0643, 0.06420000000000001, 0.0643, + 0.06420000000000001, 0.06420000000000001, 0.0643, 0.0643, 0.0643, 0.0643, 0.0645, 0.0643, 0.0643, 0.0643, + 0.06420000000000001, 0.0643, 0.06420000000000001, 0.0643, 0.0643, 0.0643, 0.06420000000000001, 0.0643, 0.0643, 0.0643, + 0.0643, 0.06420000000000001, 0.06420000000000001, 0.0643, 0.06420000000000001, 0.06420000000000001, 0.0643, 0.0643, + 0.06420000000000001, 0.06420000000000001, 0.06420000000000001, 0.06420000000000001, 0.06420000000000001, 0.0643, + 0.06420000000000001, 0.06420000000000001, 0.06420000000000001, 0.06420000000000001, 0.06420000000000001, + 0.06459999999999999, 0.0643, 0.06420000000000001, 0.06420000000000001, 0.06420000000000001, 0.06420000000000001 ] }, "iperf": { "unit": "bit/s", "results": [ - 1870000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4780000000, - 4730000000, - 4720000000 + 1870000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, + 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, + 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, + 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, + 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, + 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, 4780000000, + 4730000000, 4720000000 ] } -} \ No newline at end of file +} diff --git a/perf/runner/src/versions.ts b/perf/runner/src/versions.ts index 86c0386..5bcff20 100644 --- a/perf/runner/src/versions.ts +++ b/perf/runner/src/versions.ts @@ -40,4 +40,9 @@ export const versions: Array = [ implementation: "go-libp2p", transportStacks: ["tcp", "quic-v1"] }, + { + id: "v0.46", + implementation: "js-libp2p", + transportStacks: ["tcp"] + } ]