by fnord77 · 4y ago · 0 comments
the python version is 100x less energy efficient than the rust version. that 5 hours extra work now becomes a bargain.
Not necessarily. If the limiting factor is network access, then the language you write in wouldn't make any difference. You could say you would use less ram with the rust version, but ram is cheap compared to developer time.
how?
Some optimizations become much easier in the actual running environment. You know the hardware so don't have to cater to lowest common denominator, and you know what's actually happening and don't have to guess.
Profile-guided optimizations later showed up to bridge some of the gap, but I think JITs are typically built with a different mind set, so there are some things they excel at.
A funny example is something like a regexp matcher where a JIT might take an actual regexp built on the fly, say based on a user searching for "foo bar", and optimize code for it.
"You Ain't Gonna Need It." --Martin Fowler
I'm not saying don't do it -- in some cases it makes sense say as an open source project. But you can get away with a lot of python code before you have to break out the compiled languages -- particularly if the IO cost is significantly more time consuming than your business logic.
Personally, I wouldn’t prototype in Rust either, but OTOH I’m not experienced enough in it.
I'd say building V1 in a rapid development language and then never porting it while trying to scale it up is an even more popular pattern.
There are some massive web applications out there running on hopelessly outdated Django