4 ms·
I doubt the performance of a c++ web site would be better than c#/java or some other compiled languages for most non-trivial web sites. Once things like jits co
by ecshafer 9y ago
I doubt the performance of a c++ web site would be better than c#/java or some other compiled languages for most non-trivial web sites. Once things like jits come into play, and you see large projects (1million+ loc) the performance advantage of c++ often disappears or it becomes less performant for things like web sites. Most companies do not have the time nor ability to do all those optimizations that theoretically exist that would make c++ more performant.
This isn't even counting the dev time difference
- quickben 9y agoThe performance would be notable. However, hardware is cheap these days.
- dahart 9y ago> The performance would be notable. Can you quantify & explain what you mean by notable? I've written a lot of C++ and also a lot of scripted web services like node.js and flask (python). For most normal websites, I doubt that you could make significant and noticeable performance improvements to a decent scripted backend by switching to c++, from the user's point of view. A latency savings of a millisecond or two across the board I could buy, but making it obviously faster to a user, I'm skeptical, unless the site has non-traditional high performance requirements.
- Iwan-Zotow 9y agoWhat exactly is the "performance" you're talking about? How you define it?
- dahart 9y ago> What exactly is the "performance" you're talking about? How do you define it? You can see that that was precisely my question, right? Did you mean to reply to the parent comment? The article says the reason to use C++ over rails or node or another scripting language is "performance", the parent comment to mine said that the performance difference would be "notable". I'm asking exactly what you're asking -- what is performance, what is notable? On top of that, I did define performance loosely in my comment -- as something that is noticeably faster to the user. If a user running Chrome can feel the difference on a site, and the only difference is the language it was written in, then I could buy that C++ gives better "performance". I suspect it's rather difficult to write a custom C++ web server and make it load or run any faster, from the point of view of the person on the other end, than a generic rails/flask/nodejs web site, for most sites.
- Iwan-Zotow 9y ago> as something that is noticeably faster to the user you know, there might be MORE THAN ONE user so if server is done in, say, python, then user #11 will get slowdown. With C++, slowdown might start with user #50 (or 100, or ...)
- dahart 9y agoThanks. Yes. I said this very thing in my top comment. It takes a lot of users (many more than 10!) in any modern web server framework to get noticeable slowdowns, unless you've done something horribly wrong. So the question on the table -- still -- is what web applications might actually require a C++ web server, in practice?
- dfox 9y agoC++ advocates often talk about the performance gains. The problem with that is that what C++ buys you is not better performance or even predictable performance, but repeatable performance, which is not that useful for anything not hard-realtime. For typical large OO codebase some kind of tracing GC is almost always better than various reference counting and tracking schemes. For the unpredictability the problem has to do with the fact that even simplest C++ statement might cause the compiler to generate several kilobytes of inlined code.
- kazinator 9y agoC++ only has repeatable performance if used in certain ways. > various reference counting and tracking schemes. Reference counting doesn't always have repeatable performance. Maybe for a program image started from scratch on exactly the same non-real-time input. But then almost anything has repeatable performance for that, including ordinary mark-and-sweep garbage collection.
- dfox 9y agoMy point was that only reason to use C++ is when you want repeatable performance which implies that you will not do things that are against this goal (and in fact C++ makes various tricks to achieve this goal trivial, eg. per-timestep heaps) My other point was that for anything other you do not want to use C++. Edit: and also "when used in certain ways" is exactly the problem with C++ I tried to point out. The language and it's interactions with real implementations is simply too complex for any kind of useful analysis.
- kazinator 9y ago> c++ web site would be No "would" about it C++ web sites are real and have been around for a long time. I'm thinking of sites running on Windows using "ISAPI".
- dahart 9y agoIs their performance demonstrably better than other sites? Parent wasn't saying that c++ sites don't exist, just speculating that it doesn't necessarily make the site clearly faster to browse. I'd speculate the same, but would appreciate if there's hard data around to educate me, I'm genuinely curious what the benefits of going c++ are.