Ask HN: Compiled Web App
I desperately want to build radically fast and lean web apps.
My stack at the moment is nginx > nodejs > sqlite. To step it up I want to replace nodejs with a compiled app. What language should I use ?
Precision : I'd prefer a C-like language since I'm comfortable in JS and C.
- C/C++ are excluded for obvious reasons.
- D looks REALLY nice but lacks momentum at first glance. (few packages - only one for async-http, one for sqlite - and a not-so-busy forum)
- Go ? I'd like to avoid it.
- Zig : as alluring as D but not stabilized.
- Rust : too unfamiliar.
19 comments
[ 1.7 ms ] story [ 53.0 ms ] threadSince I want to keep it modular, the db part with sqlite is already optimal. Now I need the app on par : statically typed, compiled.
I'm gonna rewrite my backend using epoll and coroutine.
D permits that. I guess you are comfortable with C++ but I would not even try..
it's based on Qt, but my rewrite will be pure c++.
C# and .NET are VM/bytecode I think and like 1/4th the speed of C.
There have been several articles on HN stating that .NET core is considerable less resource intensive than Node in real world use cases.
I'm not clear you have a real world use case though.
You never mention you want natively compiled languages but just compiled languages.
- Haskell: very fast but probably more "unfamiliar" to you than Rust
- Common Lisp: fast, very stable, easier than Haskell (semantics similar to Python/Javascript) but definitely not mainstream
- FORTH: very fast but memory-unsafe and semantically+syntactically almost polar opposite of most popular languages
- I don't exclude D but it means some untrivial learning in spite of its semblance to C. I don't have infinite time to learn all promising C++ replacements.
- Haskell.. really ? Plus it's not fast at all it seems.
- Lisp : interesting idea. I'd prefer a C-like language but learning it expands your mind they say.
The D one (vibed) doesn't shine much. Alas.
Maybe you're right and I should take the dive with Rust.
If you aren't proficient in a functional language like Haskell then you haven't completed your programming education. Go, Rust, D, etc. are all just C with fancy features. Change your whole programming paradigm.
Here's a great deep-dive into Haskell web server performance: https://www.aosabook.org/en/posa/warp.html
And if you're building an API you don't need to code! Just throw postgREST in front of a postgreSQL database and get a haskell-powered API for free. No need to write a web server.
> Go, Rust, D, etc. are all just C with fancy features
Come on.. Their fanciness is very helpful. Doing web in C is tedious, insecure.
> Change your whole programming paradigm.
That is no small endeavour but I hear you !
I just read that Go is not best for low-level optimizations, and memory size.