https://github.com/neandertech/smithy4s-curl
This scala-cli script has two entrypoints, so you can produce two binaries from it - one using curl, and one using http4s Ember.
Because native dependencies are required for both entrypoints, I prefer to build them using my sn-vcpkg CLI:
To produce a binary using curl:
$ sn-vcpkg scala-cli curl --rename curl=libcurl -- package . -f -o ./native-curl -M helloCurl
To produce a binary using http4s ember:
$ sn-vcpkg scala-cli s2n openssl zlib -- package . -f -o ./native-ember -M helloEmber
Sizes comparison:
.rwxr-xr-x 11M 19 Jul 13:53 native-curl
.rwxr-xr-x 42M 19 Jul 13:56 native-ember
Basic hyperfine perf measurement against locally running httpbin:
> hyperfine './native-ember http://localhost:8081' './native-curl http://localhost:8081' -w 10
Benchmark 1: ./native-ember http://localhost:8081
Time (mean ± σ): 136.2 ms ± 5.3 ms [User: 124.9 ms, System: 6.5 ms]
Range (min … max): 133.0 ms … 158.0 ms 22 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Benchmark 2: ./native-curl http://localhost:8081
Time (mean ± σ): 11.9 ms ± 1.9 ms [User: 2.9 ms, System: 2.1 ms]
Range (min … max): 9.5 ms … 25.8 ms 207 runs
Summary
./native-curl http://localhost:8081 ran
11.44 ± 1.90 times faster than ./native-ember http://localhost:8081
Note that it's cheating a bit because we're linking against a release-built curl library, whereas the pure scala code of ember has no optimisations.