3 ms·
Honset curiosity: is there a reason Golang or rust couldn't perform same or better? I get why as a programmer I would use C, but what benefit does it have for t
by badrabbit 8y ago
Honset curiosity: is there a reason Golang or rust couldn't perform same or better? I get why as a programmer I would use C, but what benefit does it have for the users of the app?
- jolmg 8y agoThe users of the framework, the programmers of a webapp? I imagine that there's few frameworks for web development in C, so having options is good. It's also probably way more portable than Golang or rust. That's also useful for the users of the webapp if they want to host it. I mean, it probably takes less effort to get it to compile and run on a system like SCO, compared to doing that with Golang or rust. You'd think legacy systems don't matter, but I imagine that there's still many businesses that heavily depend on such legacy systems because the costs to safely migrate are big. Making it in C is probably also going to result in far smaller compiled code, since I imagine C requires a far smaller RTS than Golang or rust. That might make a difference for people that for some reason want to run a webapp on a small device. I may be wrong though, since I don't have any experience with Golang or rust.
- badrabbit 8y agoI meant the users of the webapp.
- loeg 8y agoSure. Go is a garbage-collected language with an immature and unsophisticated compiler toolchain, compared to the big free C compilers like GCC or Clang. The compiler limitations are solvable but GC is a core part of the language. Interoperability with C libraries is possible but not great. Rust is built on LLVM, much like Clang. C integration is relatively easy. I think this is more viable than Go. Unfortunately, Rust is only portable to platforms LLVM supports. While that covers the majority of commonly used hardware today, it is not comprehensive. Also, Rust compile times are pretty bad, especially for optimized builds. At the end of the day the author gets to write code in a language of their choice to scratch their own itch. End users don't care at all what language a web framework is written in.
- oritsnile 8y agoAs far as I know rust isn't garbage collected
- loeg 8y agoReference counting is a form of GC. https://words.steveklabnik.com/borrow-checking-escape-analysis-and-the-generational-hypothesis https://words.steveklabnik.com/borrow-checking-escape-analys...
- dwaltrip 8y agoRust doesn't do runtime garbage collection. It "garbage collects" at compile time, in a highly optimized way, the same way a human would by manually writing "free". My understanding is that Rust does this well enough that there isn't really a performance cost compared to C. Edit: I see your other comment about the use of Arc and Rc in the stdlib, that is a good point. However, how much does that actually matter? I'm genuinely curious, my guess is that it is not significant, but I'm not well informed. For example, would that affect embedded use cases?
- burntsushi 8y agoRust is no more a garbage collected language than C is. Just as one can implement reference counting in C, one can do the same in Rust, but it is not forced on you just like it is not forced on you in C.
- loeg 8y agoI consider the standard libraries part of the language. C stdlib does not include ref counting, nor is there any refcounting construct available without building it yourself. Rust obviously has Rc<> and Arc<>.
- burntsushi 8y ago> Rust obviously has Rc<> and Arc<> and uses it widely in the standard library. No, it's not. None of the core data structures (String, Vec, HashMap, BTreeMap, VecDeque), for example, use it. Rust is not a garbage collected language in any meaningful sense of the word. Its runtime is approximately the same size as C's, and the vast majority of all memory management in the Rust ecosystem is done with traditional malloc/free calls. The only difference between Rust and C at this level is that Rust inserts those calls for you automatically. In exchange, the space of programs accepted by the Rust compiler is smaller than what is accepted by a C compiler. > At the moment it is a garbage-collected language but IIRC they are trying to move away from that as a requirement. No, we're not. Because no such requirement exists and the vast majority of Rust code doesn't use reference counting at all. If anything, there are some folks that have looked into adding tracing garbage collection to Rust as a library.