Marcel Weiher
07/30/2023, 8:23 AMscheme Hello
{
/hi/:p1 {
get {
'hello: ',p1.
}
}
-main:args
{
self waitOnPort: 8081 intValue.
}
}
So that little test program can now be fully compiler to an ARM64 binary.
]stc <http://SchemeDefHTTP.st|SchemeDefHTTP.st>
]file SchemeDefHTTP
SchemeDefHTTP: Mach-O 64-bit executable arm64
]./SchemeDefHTTP
2023-07-30 10:16:36.680 SchemeDefHTTP[51040:2409943] will listen on port: 8081
From another shell:
]curl <http://localhost:8081/hi/Marcel>
hello: Marcel%
]wrk <http://localhost:8081/hi/Marcel>
Running 10s test @ <http://localhost:8081/hi/Marcel>
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 57.33us 15.35us 1.13ms 80.91%
Req/Sec 75.02k 3.81k 78.81k 95.54%
1507905 requests in 10.10s, 198.45MB read
Requests/sec: 149295.29
Transfer/sec: 19.65MB
So more expressive than something like sinatra, but running at cool 140K requests/s.
The dichotomy between expressiveness/comfort and performance is a false one, a bit like the one we used to have between user-friendly but crashy client-operating systems and solid but unfriendly server operating systems. Now my phone and my watch both run Unix.Kartik Agaram
Marcel Weiher
07/31/2023, 10:18 AMKartik Agaram
stc
being developed in https://objective.st, or is it a new project?Marcel Weiher
07/31/2023, 4:20 PMstc
is a small script that drives the ObjSTNative
framework, both are part of https://objective.st
#!env st
#-<void>compile:source
framework:ObjSTNative load.
basename := source stringValue stringByDeletingPathExtension.
compiler := STNativeCompiler compiler.
compiled := compiler compileProcessToMachoO: (compiler compile: file:{source}).
objectFileName := basename , '.o'.
file:{objectFileName} := compiled.
compiler linkObjects: #[ basename ] toExecutable: basename inDir: nil additionalFrameworks:[ 'ObjectiveHttpd' ].
https://gitlab.com/mpwmo/ObjectiveSmalltalk/-/blob/master/scripts/compile/stc
https://gitlab.com/mpwmo/ObjectiveSmalltalk/-/tree/master/ObjSTNative