Skip to content

Commit d3a6870

Browse files
authored
Merge pull request #758 from praisethemoon/sch/typev-v17
typev: update runtime, improves gc & memory reclamation
2 parents 396099c + 9052d15 commit d3a6870

22 files changed

Lines changed: 148 additions & 157 deletions

frameworks/typev/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WORKDIR /app
1212
# typev VM — binary + FFI plugins (json, stdcore, stdsocket, ...). Pre-built
1313
# (-O3 -march=x86-64-v3, static liburing) and fetched from object storage
1414
RUN wget -q -O /tmp/typev.zip \
15-
https://typev.s3.fr-par.scw.cloud/typev-21-05-2026.zip && \
15+
https://typev.s3.fr-par.scw.cloud/typev-23-05-2026-v2.zip && \
1616
unzip -q /tmp/typev.zip -d /app && \
1717
rm /tmp/typev.zip
1818

frameworks/typev/bundle/benchmark-code/src/main.tc

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,14 @@ fn drainUpload(fd: int, buf: byte[], bufcap: uint, bodyStart: uint, cl: uint, cu
9999

100100
// Serve one connection.
101101
fn handle_client(fd: int) -> void {
102+
// resizeRaw: these buffers are write-before-read (tcp_read fills, parser
103+
// reads only up to the filled length), so skip the per-connection zero-fill.
102104
let buf: byte[] = []
103-
buf.resize(BUFCAP)
105+
buf.resizeRaw(BUFCAP)
104106
let tmp: byte[] = []
105-
tmp.resize(BUFCAP)
107+
tmp.resizeRaw(BUFCAP)
106108
let obuf: byte[] = []
107-
obuf.resize(OBUFCAP)
109+
obuf.resizeRaw(OBUFCAP)
108110
// Parse scratch — created once, reused for every request.
109111
let req = newReq()
110112
let chunk = newChunk()
@@ -277,22 +279,11 @@ fn accept_loop() -> void {
277279
fn main() -> uint {
278280
println("typev HttpArena server listening on :8080")
279281

280-
foreach i in 0, 3, 1 {
282+
let keepalive = spawn accept_loop()
283+
foreach i in 0, 2, 1 {
281284
spawn accept_loop()
282285
}
283-
284-
let server = tcp_listen(PORT, 4096)
285-
if server < 0 {
286-
println("Failed to start server")
287-
return 1u
288-
}
289-
290-
while true {
291-
let client = tcp_accept(server)
292-
if client >= 0 {
293-
spawn handle_client(client)
294-
}
295-
}
286+
let (_r, _s) = keepalive.await()
296287

297288
return 0u
298289
}
-398 Bytes
Binary file not shown.

site/data/baseline-4096.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,19 +1308,19 @@
13081308
{
13091309
"framework": "typev",
13101310
"language": "Type-C",
1311-
"rps": 2238245,
1312-
"avg_latency": "160us",
1313-
"p99_latency": "681us",
1314-
"cpu": "6230.3%",
1315-
"memory": "448MiB",
1311+
"rps": 2159262,
1312+
"avg_latency": "150us",
1313+
"p99_latency": "729us",
1314+
"cpu": "6556.8%",
1315+
"memory": "396MiB",
13161316
"connections": 4096,
13171317
"threads": 64,
13181318
"duration": "5s",
13191319
"pipeline": 1,
1320-
"bandwidth": "192.04MB/s",
1321-
"input_bw": "172.90MB/s",
1320+
"bandwidth": "185.27MB/s",
1321+
"input_bw": "166.80MB/s",
13221322
"reconnects": 0,
1323-
"status_2xx": 11191228,
1323+
"status_2xx": 10796310,
13241324
"status_3xx": 0,
13251325
"status_4xx": 0,
13261326
"status_5xx": 0

site/data/baseline-512.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,19 +1308,19 @@
13081308
{
13091309
"framework": "typev",
13101310
"language": "Type-C",
1311-
"rps": 2230325,
1312-
"avg_latency": "125us",
1313-
"p99_latency": "665us",
1314-
"cpu": "6378.6%",
1315-
"memory": "211MiB",
1311+
"rps": 2232140,
1312+
"avg_latency": "107us",
1313+
"p99_latency": "636us",
1314+
"cpu": "6380.0%",
1315+
"memory": "156MiB",
13161316
"connections": 512,
13171317
"threads": 64,
13181318
"duration": "5s",
13191319
"pipeline": 1,
1320-
"bandwidth": "191.36MB/s",
1321-
"input_bw": "172.29MB/s",
1320+
"bandwidth": "191.53MB/s",
1321+
"input_bw": "172.43MB/s",
13221322
"reconnects": 0,
1323-
"status_2xx": 11151628,
1323+
"status_2xx": 11160704,
13241324
"status_3xx": 0,
13251325
"status_4xx": 0,
13261326
"status_5xx": 0

site/data/current.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"threads_per_core": "2",
66
"ram": "251Gi",
77
"os": "Ubuntu 24.04.4 LTS",
8-
"kernel": "6.17.0-22-generic",
8+
"kernel": "6.17.0-29-generic",
99
"docker": "29.3.0",
1010
"docker_runtime": "runc",
1111
"governor": "performance",

site/data/echo-ws-16384.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,18 @@
369369
{
370370
"framework": "typev",
371371
"language": "Type-C",
372-
"rps": 3048278,
373-
"avg_latency": "170us",
374-
"p99_latency": "1.53ms",
375-
"cpu": "6266.4%",
376-
"memory": "751MiB",
372+
"rps": 2681888,
373+
"avg_latency": "160us",
374+
"p99_latency": "1.02ms",
375+
"cpu": "6185.7%",
376+
"memory": "818MiB",
377377
"connections": 16384,
378378
"threads": 64,
379379
"duration": "5s",
380380
"pipeline": 1,
381-
"bandwidth": "20.37MB/s",
381+
"bandwidth": "18.01MB/s",
382382
"reconnects": 0,
383-
"status_2xx": 15241392,
383+
"status_2xx": 13409442,
384384
"status_3xx": 0,
385385
"status_4xx": 0,
386386
"status_5xx": 0

site/data/echo-ws-4096.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,18 @@
369369
{
370370
"framework": "typev",
371371
"language": "Type-C",
372-
"rps": 2981735,
373-
"avg_latency": "145us",
374-
"p99_latency": "548us",
375-
"cpu": "6441.7%",
376-
"memory": "450MiB",
372+
"rps": 2738284,
373+
"avg_latency": "140us",
374+
"p99_latency": "639us",
375+
"cpu": "6294.2%",
376+
"memory": "464MiB",
377377
"connections": 4096,
378378
"threads": 64,
379379
"duration": "5s",
380380
"pipeline": 1,
381-
"bandwidth": "19.90MB/s",
381+
"bandwidth": "18.28MB/s",
382382
"reconnects": 0,
383-
"status_2xx": 14908675,
383+
"status_2xx": 13691422,
384384
"status_3xx": 0,
385385
"status_4xx": 0,
386386
"status_5xx": 0

site/data/echo-ws-512.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,18 @@
369369
{
370370
"framework": "typev",
371371
"language": "Type-C",
372-
"rps": 3017632,
373-
"avg_latency": "105us",
374-
"p99_latency": "480us",
375-
"cpu": "6739.4%",
376-
"memory": "269MiB",
372+
"rps": 2839865,
373+
"avg_latency": "93us",
374+
"p99_latency": "474us",
375+
"cpu": "6717.4%",
376+
"memory": "177MiB",
377377
"connections": 512,
378378
"threads": 64,
379379
"duration": "5s",
380380
"pipeline": 1,
381-
"bandwidth": "20.14MB/s",
381+
"bandwidth": "18.95MB/s",
382382
"reconnects": 0,
383-
"status_2xx": 15088164,
383+
"status_2xx": 14199326,
384384
"status_3xx": 0,
385385
"status_4xx": 0,
386386
"status_5xx": 0

site/data/echo-ws-pipeline-16384.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,18 @@
230230
{
231231
"framework": "typev",
232232
"language": "Type-C",
233-
"rps": 19139286,
234-
"avg_latency": "308us",
235-
"p99_latency": "1.04ms",
236-
"cpu": "6358.2%",
237-
"memory": "458MiB",
233+
"rps": 18274678,
234+
"avg_latency": "386us",
235+
"p99_latency": "2.74ms",
236+
"cpu": "6083.0%",
237+
"memory": "362MiB",
238238
"connections": 16384,
239239
"threads": 64,
240240
"duration": "5s",
241241
"pipeline": 16,
242-
"bandwidth": "127.73MB/s",
242+
"bandwidth": "121.96MB/s",
243243
"reconnects": 0,
244-
"status_2xx": 95696432,
244+
"status_2xx": 91373392,
245245
"status_3xx": 0,
246246
"status_4xx": 0,
247247
"status_5xx": 0

0 commit comments

Comments
 (0)