From dd36903c4f042f5ce4cf64ce1afb64fb79f9b4fd Mon Sep 17 00:00:00 2001 From: Oleg Kulikov Date: Fri, 6 Mar 2026 04:27:41 +0300 Subject: [PATCH 1/5] Funxy/funxy-stdlib --- frameworks/Funxy/funxy-stdlib/Dockerfile | 23 +++++++++++++ frameworks/Funxy/funxy-stdlib/README.md | 16 ++++++++++ .../Funxy/funxy-stdlib/benchmark_config.json | 21 ++++++++++++ frameworks/Funxy/funxy-stdlib/supervisor.lang | 32 +++++++++++++++++++ frameworks/Funxy/funxy-stdlib/worker.lang | 26 +++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 frameworks/Funxy/funxy-stdlib/Dockerfile create mode 100644 frameworks/Funxy/funxy-stdlib/README.md create mode 100644 frameworks/Funxy/funxy-stdlib/benchmark_config.json create mode 100644 frameworks/Funxy/funxy-stdlib/supervisor.lang create mode 100644 frameworks/Funxy/funxy-stdlib/worker.lang diff --git a/frameworks/Funxy/funxy-stdlib/Dockerfile b/frameworks/Funxy/funxy-stdlib/Dockerfile new file mode 100644 index 00000000000..0e462bb9515 --- /dev/null +++ b/frameworks/Funxy/funxy-stdlib/Dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:22.04 + +RUN apt-get update && \ + apt-get install -y curl ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# Install Funxy binary directly (non-interactive, Docker-friendly) +RUN set -eux; \ + arch="$(dpkg --print-architecture)"; \ + case "$arch" in \ + amd64) funxy_arch="amd64" ;; \ + arm64) funxy_arch="arm64" ;; \ + *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \ + esac; \ + curl -fsSL -o /usr/local/bin/funxy "https://github.com/funvibe/funxy/releases/latest/download/funxy-linux-${funxy_arch}"; \ + chmod +x /usr/local/bin/funxy + +WORKDIR /app +COPY supervisor.lang worker.lang ./ + +EXPOSE 8080 + +CMD ["funxy", "vmm", "supervisor.lang"] \ No newline at end of file diff --git a/frameworks/Funxy/funxy-stdlib/README.md b/frameworks/Funxy/funxy-stdlib/README.md new file mode 100644 index 00000000000..88ea860b1f5 --- /dev/null +++ b/frameworks/Funxy/funxy-stdlib/README.md @@ -0,0 +1,16 @@ +# Funxy (stdlib) + +[Funxy](https://github.com/funvibe/funxy) is a general-purpose scripting language with static typing and type inference. + +- Homepage: https://github.com/funvibe/funxy +- Documentation: https://github.com/funvibe/funxy/tree/main/docs + +This implementation targets the following TechEmpower tests: + +- Plaintext (`/plaintext`) +- JSON Serialization (`/json`) + +Implementation files in this directory: + +- `supervisor.lang` +- `worker.lang` diff --git a/frameworks/Funxy/funxy-stdlib/benchmark_config.json b/frameworks/Funxy/funxy-stdlib/benchmark_config.json new file mode 100644 index 00000000000..c2d2f65749f --- /dev/null +++ b/frameworks/Funxy/funxy-stdlib/benchmark_config.json @@ -0,0 +1,21 @@ +{ + "framework": "funxy", + "tests": [ + { + "default": { + "json_url": "/json", + "plaintext_url": "/plaintext", + "port": 8080, + "approach": "Realistic", + "classification": "Fullstack", + "framework": "funxy", + "language": "Funxy", + "webserver": "None", + "os": "Linux", + "display_name": "funxy", + "notes": "", + "versus": "None" + } + } + ] +} diff --git a/frameworks/Funxy/funxy-stdlib/supervisor.lang b/frameworks/Funxy/funxy-stdlib/supervisor.lang new file mode 100644 index 00000000000..92fa8fa53f9 --- /dev/null +++ b/frameworks/Funxy/funxy-stdlib/supervisor.lang @@ -0,0 +1,32 @@ +import "lib/vmm" (spawnVMGroup) +import "lib/time" (sleepMs) +import "lib/sys" (sysScriptDir, sysCPUCount) +import "lib/path" (pathJoin) +import "lib/flag" (flagSet, flagParse, flagGet) + +// Override with --workers N. +// If omitted or <= 0, use runtime CPU parallelism from sysCPUCount(). +flagSet("workers", 0, "number of worker VMs (<=0 means auto-detect)") +flagParse() +workersFlag = flagGet("workers") +logicalCPU = sysCPUCount() +cores = if workersFlag > 0 { workersFlag } else { logicalCPU } +if cores <= 0 { + panic("invalid worker count: " ++ show(cores)) +} + +worker_path = pathJoin([sysScriptDir(), "worker.lang"]) +print("Starting TFB cluster with workers=" ++ show(cores) ++ " (runtime_cpu=" ++ show(logicalCPU) ++ ")") + +match spawnVMGroup(worker_path, { + group: "tfb_web", + capabilities: ["lib/http", "lib/json"] +}, cores) { + Ok(ids) -> print("Started Funxy TFB cluster. Workers: " ++ show(ids)) + Fail(e) -> panic("Failed to start cluster: " ++ e) +} + +// Block the supervisor from exiting so the VMM stays alive +while true { + sleepMs(1000) +} diff --git a/frameworks/Funxy/funxy-stdlib/worker.lang b/frameworks/Funxy/funxy-stdlib/worker.lang new file mode 100644 index 00000000000..50750f50f14 --- /dev/null +++ b/frameworks/Funxy/funxy-stdlib/worker.lang @@ -0,0 +1,26 @@ +import "lib/http" (httpServe) +import "lib/json" (jsonEncode) + +// Pre-allocate response structures to avoid allocation overhead during the hot path +headers_plain = [("Server", "Funxy"), ("Content-Type", "text/plain")] +headers_json = [("Server", "Funxy"), ("Content-Type", "application/json")] +msg_plain = "Hello, World!" + +// TechEmpower requires the Date header, but lib/http automatically adds and caches +// an accurate Date header for us, so we don't need to generate it manually. +httpServe(8080, fun(req) { + match req.path { + "/plaintext" -> { + status: 200, + headers: headers_plain, + body: msg_plain + } + "/json" -> { + status: 200, + headers: headers_json, + // Construct the map dynamically for each request as per TFB rules + body: jsonEncode({ message: "Hello, World!" }) + } + _ -> { status: 404, body: "" } + } +}) From d7f1554e071a9cf8030e94de721361c18ba9ba57 Mon Sep 17 00:00:00 2001 From: Oleg Kulikov Date: Fri, 6 Mar 2026 15:43:57 +0300 Subject: [PATCH 2/5] add maintainers --- frameworks/Funxy/funxy-stdlib/benchmark_config.json | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/Funxy/funxy-stdlib/benchmark_config.json b/frameworks/Funxy/funxy-stdlib/benchmark_config.json index c2d2f65749f..17f92ea4385 100644 --- a/frameworks/Funxy/funxy-stdlib/benchmark_config.json +++ b/frameworks/Funxy/funxy-stdlib/benchmark_config.json @@ -1,5 +1,6 @@ { "framework": "funxy", + "maintainers": ["oakulikov", "funvibe"], "tests": [ { "default": { From 27fb6fa541c5f54c663fda862397dddd3453e100 Mon Sep 17 00:00:00 2001 From: Oleg Kulikov Date: Sat, 7 Mar 2026 00:11:50 +0300 Subject: [PATCH 3/5] rename dockerfile --- frameworks/Funxy/funxy-stdlib/benchmark_config.json | 2 +- frameworks/Funxy/funxy-stdlib/{Dockerfile => funxy.dockerfile} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename frameworks/Funxy/funxy-stdlib/{Dockerfile => funxy.dockerfile} (100%) diff --git a/frameworks/Funxy/funxy-stdlib/benchmark_config.json b/frameworks/Funxy/funxy-stdlib/benchmark_config.json index 17f92ea4385..a64d86b6cad 100644 --- a/frameworks/Funxy/funxy-stdlib/benchmark_config.json +++ b/frameworks/Funxy/funxy-stdlib/benchmark_config.json @@ -13,7 +13,7 @@ "language": "Funxy", "webserver": "None", "os": "Linux", - "display_name": "funxy", + "display_name": "funxy_stdlib", "notes": "", "versus": "None" } diff --git a/frameworks/Funxy/funxy-stdlib/Dockerfile b/frameworks/Funxy/funxy-stdlib/funxy.dockerfile similarity index 100% rename from frameworks/Funxy/funxy-stdlib/Dockerfile rename to frameworks/Funxy/funxy-stdlib/funxy.dockerfile From 05e74728d8f14b7d4f7a32aec51f0ffa2f2cb863 Mon Sep 17 00:00:00 2001 From: Oleg Kulikov Date: Wed, 11 Mar 2026 23:41:06 +0300 Subject: [PATCH 4/5] fix headers --- frameworks/Funxy/funxy-stdlib/worker.lang | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/Funxy/funxy-stdlib/worker.lang b/frameworks/Funxy/funxy-stdlib/worker.lang index 50750f50f14..5a4c118beed 100644 --- a/frameworks/Funxy/funxy-stdlib/worker.lang +++ b/frameworks/Funxy/funxy-stdlib/worker.lang @@ -3,7 +3,6 @@ import "lib/json" (jsonEncode) // Pre-allocate response structures to avoid allocation overhead during the hot path headers_plain = [("Server", "Funxy"), ("Content-Type", "text/plain")] -headers_json = [("Server", "Funxy"), ("Content-Type", "application/json")] msg_plain = "Hello, World!" // TechEmpower requires the Date header, but lib/http automatically adds and caches @@ -17,7 +16,7 @@ httpServe(8080, fun(req) { } "/json" -> { status: 200, - headers: headers_json, + headers: [("Server", "Funxy"), ("Content-Type", "application/json")], // Construct the map dynamically for each request as per TFB rules body: jsonEncode({ message: "Hello, World!" }) } From cb8249fe18da4a73fb1d4e8fb73618c88328b5ad Mon Sep 17 00:00:00 2001 From: Oleg Kulikov Date: Fri, 13 Mar 2026 16:53:14 +0300 Subject: [PATCH 5/5] json encode bytes --- frameworks/Funxy/funxy-stdlib/worker.lang | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frameworks/Funxy/funxy-stdlib/worker.lang b/frameworks/Funxy/funxy-stdlib/worker.lang index 5a4c118beed..d871373a23c 100644 --- a/frameworks/Funxy/funxy-stdlib/worker.lang +++ b/frameworks/Funxy/funxy-stdlib/worker.lang @@ -1,5 +1,5 @@ import "lib/http" (httpServe) -import "lib/json" (jsonEncode) +import "lib/json" (jsonEncodeBytes) // Pre-allocate response structures to avoid allocation overhead during the hot path headers_plain = [("Server", "Funxy"), ("Content-Type", "text/plain")] @@ -17,8 +17,7 @@ httpServe(8080, fun(req) { "/json" -> { status: 200, headers: [("Server", "Funxy"), ("Content-Type", "application/json")], - // Construct the map dynamically for each request as per TFB rules - body: jsonEncode({ message: "Hello, World!" }) + body: jsonEncodeBytes({ message: "Hello, World!" }) } _ -> { status: 404, body: "" } }