Hyperlambda is Twice as Fast as Rust with Actix-Web
I ran the same tests I've already executed towards Flask and Fast API towards Rust with Actix-Web, and Hyperlambda is twice as fast as the Rust equivalent.
The test is as follows; I've got a Python script that creates 50 worker threads or tasks, where each task is "hammering" an HTTP endpoint that returns all Artist rows from my "chinook" SQLite database.
Then I count successful invocations after 30 seconds of execution. This simulates how your web server will behave under "extreme loads", and is therefore a good measure of the framework's "throughput". The result?
- Rust with Actix-Web; 38,500 requests
- Hyperlambda; 75,500
Implying; Hyperlambda actually scales at least twice as well as Rust with Actix-Web.
WTF ???????????
This doesn't make any sense what so ever to be honest with you. I had to run the tests 3 times to make sure I wasn't hallucinating. In theory Rust should be roughly 10x faster than C#. Hyperlambda is built in C#, so how can it outperform its Rust equivalent? I think I know the answer, but before I explain, below is the Rust code I was using such that you can reproduce my findings.
use actix_web::{get, App, HttpServer, Responder, web};
use serde::Serialize;
use sqlx::{SqlitePool, FromRow};
#[derive(Serialize, FromRow)]
struct Artist {
ArtistId: i32,
Name: Option,
}
#[get("/artists")]
async fn get_artists(db: web::Data) -> impl Responder {
let rows = sqlx::query_as::<_, Artist>("SELECT ArtistId, Name FROM Artist")
.fetch_all(db.get_ref())
.await;
match rows {
Ok(artists) => web::Json(artists),
Err(err) => {
eprintln!("Database error: {:?}", err);
web::Json(vec![])
}
}
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
// Change this path to where your chinook.db file is located
let database_url = "sqlite://./chinook.db";
// Create connection pool
let pool = SqlitePool::connect(database_url)
.await
.expect("Failed to connect to database");
println!("Server running at http://127.0.0.1:8080");
HttpServer::new(move || {
App::new()
.app_data(web::Data::new(pool.clone()))
.service(get_artists)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}
Below is my cargo file.
[package]
name = "actix_chinook"
version = "0.1.0"
edition = "2021"
[dependencies]
actix-web = "4"
serde = { version = "1", features = ["derive"] }
sqlx = { version = "0.7", features = ["runtime-tokio", "sqlite"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
The Hyperlambda code was generated using our CRUD generator, but since I've been critisised for not showing it previously, here's the complete Hyperlambda code.
data.connect:chinook
data.read
table:Artist
return:x:-/*
Architecture and Code Quality
If you gave a hammer to a monkey, it would still destroy things, and not build things. Rust might be a faster language than C# and Hyperlambda, on similar algorithms, but performance of the language doesn't always equal performance of your solution.
To create high performance solutions you need great architecture created on a good foundation of software design principles. For years I've been advocating simplicity as the only solution to accomplish this. About 1% of software developers believes me, and the rest are happily applying DDD, Design Patterns, CQRS, and SOLID - Without thinking about the consequences it has for their performance.
As for me, I save straight to production, and I have zero unit tests. You wouldn't find as much as a single "DDD idea" in Hyperlambda, and I wouldn't implement CQRS even if you pulled a gun to my head! And its codebase is using one simple design pattern! The end result becomes a blistering fast framework capable of outperforming other frameworks built in languages that at least in theory should deliver 10x as much throughput.
Basically, Actix-Web is simply fundamentally flawed, probably because of its original developers not knowing how to architect and build high performance frameworks
While I built Magic Cloud and Hyperlambda on a solid foundation with a good architecture and good software design.
Complexity Yield
Complexity yield is "the amount of cognitive energy required to write, understand, and maintain a piece of software". It's a word I invented, and it's actually a very good metric of how "complex" your codebase is. Complexity yield again can easily be measured by simply counting OpenAI tokens, allowing us to scientifically measure how complex a thing is. With Rust your complexity increases by 18 times. That implies Rust is roughly 18 times more resource demanding to maintain compared to Hyperlambda.
Implying if you need one developer working full time to maintain a Hyperlambda solution, you'd need 18 developers to maintain the equivalent Rust solution. Below is the proof.

Implying not only does a Rust solution based upon Actix-Web perform at half the performance, but you'd also need 18 times as much resources to maintain it.