Gist URL:
https://gist.github.com/omar391/bc15f0cbeaa7453d1c3d3958e736264f
Article URL:
| #!/bin/bash | |
| cat << 'EOF' > server.cjs | |
| const http = require('http'); | |
| const server = http.createServer((req, res) => res.end('ok')); | |
| server.listen(3000, () => process.exit(0)); | |
| EOF | |
| cat << 'EOF' > bun_server.js | |
| const server = Bun.serve({ |
| package bench | |
| import ( | |
| "sync" | |
| "sync/atomic" | |
| "testing" | |
| ) | |
| type RingBuffer struct { | |
| head uint64 |
| package bench | |
| import "testing" | |
| func BenchmarkPingPong(b *testing.B) { | |
| ch1 := make(chan struct{}) | |
| ch2 := make(chan struct{}) | |
| go func() { | |
| for { | |
| <-ch1 |
| # Mocking a hyperparameter tuning process | |
| simulate_model_eval <- function(params) { | |
| # Simulate evaluation time (e.g., matrix multiplication) | |
| mat <- matrix(rnorm(100 * 100), nrow = 100) | |
| res <- solve(mat %*% t(mat) + diag(100)) | |
| # Return dummy accuracy | |
| return(runif(1, 0.8, 0.95)) | |
| } |
Gist URL:
https://gist.github.com/omar391/bc15f0cbeaa7453d1c3d3958e736264f
Article URL: