←back to thread

127 points warothia | 6 comments | | HN request time: 0.234s | source | bottom
Show context
gwbas1c ◴[] No.42166517[source]
Important question: Why would anyone develop a web application in C? Typically web applications lean heavily on garbage collection and memory safety, because their bottlenecks are very rarely CPU/memory issues. The ROI on manually managing memory just isn't there for a typical web application.
replies(10): >>42166611 #>>42166628 #>>42166883 #>>42167123 #>>42167520 #>>42167739 #>>42167933 #>>42168255 #>>42169645 #>>42173754 #
1. SvenL ◴[] No.42166628[source]
On the other hand memory management in web applications is quite easy. Most of the stuff is only required for the lifetime of a request. Some stuff needs to be available the whole application life time.
replies(1): >>42168057 #
2. smt88 ◴[] No.42168057[source]
You can do this with other languages (C# for example) as well. Memory is so cheap, though, that most companies should spend their money on increasing memory rather than on paying programmers to optimize memory usage.
replies(3): >>42168124 #>>42168203 #>>42168940 #
3. HexDecOctBin ◴[] No.42168124[source]
Cheap for whom? American programmers with FAANG salaries, or an under-funded third world NGO?
replies(1): >>42171416 #
4. SvenL ◴[] No.42168203[source]
Yes, for most use cases it doesn’t really matter which language is chosen.

Regarding just spending more money on memory - I agree that it’s definitely cheaper but it’s not only about wasting bytes of memory. If the garbage collector has a lot of work to do it may also impact response time/throughput.

And yes, C# did a pretty good job with implementing mechanisms for reducing allocations on a language level. This definitely helps to reduce garbage collection.

5. marginalia_nu ◴[] No.42168940[source]
I don't think memory usage is the problem, but rather allocation costs and memory layout, i.e. performance.

Serving web traffic simply isn't a very memory hungry task.

6. kaba0 ◴[] No.42171416{3}[source]
Both. My phone could easily serve thousands of concurrent users.