Live data from Hacker News

Writing high-performance servers in modern C++

medium.com

11–20 of 77 posts

Re: Writing high-performance servers in modern C++

#12
post #9

A lot of people state that Python/PHP/Ruby/Javascript on the dynamic language side and Java and other JVM languages on the statically typed side and much quicker to develop than C++, but being a very experienced Java programmer and a decent Javascript programmer I find that I can program just as fast with C++ as long as you use the right choices of libraries and use C++11 or greater. With libraries like Boost, fbfoll…

Do you have any pointers to learn modern C++?

Some resources:

The Definitive C++ Book Guide and List : http://stackoverflow.com/questions/388242/the-definitive-c-b...

I like the breakdown of books by their goals in this FAQ : https://isocpp.org/wiki/faq/how-to-learn-cpp

I would say 'C++ Primer 5th Edition' and 'The C++ Programming Language 4th Edition' are good.

And of course, Effective Modern C++, although the other Effective series books from Meyers are a must read.

http://www.informit.com/store/c-plus-plus-primer-97803217141...

http://shop.oreilly.com/product/0636920033707.do

http://www.informit.com/store/c-plus-plus-programming-langua...

http://www.informit.com/store/effective-c-plus-plus-55-speci...

Re: Writing high-performance servers in modern C++

#13
post #3
post #2

no benchmarks. what gives ?

Yeah, and no mention about boost::async, which is in Boost, ie almost standard.

Folly, the library underneath wangle, is running on top of boost::asio, so this is basically an abstraction on asio two layers up.

Re: Writing high-performance servers in modern C++

#14

A lot of people state that Python/PHP/Ruby/Javascript on the dynamic language side and Java and other JVM languages on the statically typed side and much quicker to develop than C++, but being a very experienced Java programmer and a decent Javascript programmer I find that I can program just as fast with C++ as long as you use the right choices of libraries and use C++11 or greater. With libraries like Boost, fbfoll…

I agree. I got websocket server and client apps running in modern c++ in just a few days of tinkering in my free time. It took no longer than when setting up servers in Clojure, which is quite a productive language as well.

Re: Writing high-performance servers in modern C++

#15

A lot of people state that Python/PHP/Ruby/Javascript on the dynamic language side and Java and other JVM languages on the statically typed side and much quicker to develop than C++, but being a very experienced Java programmer and a decent Javascript programmer I find that I can program just as fast with C++ as long as you use the right choices of libraries and use C++11 or greater. With libraries like Boost, fbfoll…

Modern C++ is indeed pretty productive. It's the tooling and compile times that hold it back.

Perhaps you mean link time? If you're spending a lot of time compiling you are probably suffering from other problems. Most of C++'s issues with compilation come from needing to re-compile entire .cpp files because of a change in a depending .h file. If you properly forward your class declarations instead of including a header in a .h file, don't do template meta meta magic, and think about physical design a bit, your compilation time should be under control.

What I mean by physical design is, if a particular function is prone to be edited constantly, keep that function definition in it's own .cpp file.

of course I'll agree that in this day and age, we shouldn't worry about those sorts of things.

Re: Writing high-performance servers in modern C++

#17
post #3

Earlier quoted context omitted.

Yeah, and no mention about boost::async, which is in Boost, ie almost standard.

Folly, the library underneath wangle, is running on top of boost::asio, so this is basically an abstraction on asio two layers up.

ASIO header-only implementation is also available without Boost, fyi, as a standalone library; the same one that's in boost, but used without boost.

Re: Writing high-performance servers in modern C++

#19

Earlier quoted context omitted.

Modern C++ is indeed pretty productive. It's the tooling and compile times that hold it back.

Perhaps you mean link time? If you're spending a lot of time compiling you are probably suffering from other problems. Most of C++'s issues with compilation come from needing to re-compile entire .cpp files because of a change in a depending .h file. If you properly forward your class declarations instead of including a header in a .h file, don't do template meta meta magic, and think about physical design a bit, you…

But when you do need generics and use templates, you are forced to write lots of code in .h files. There is very little you can do in that case to speed up build times, without resorting to devious things like PIMPL.

Re: Writing high-performance servers in modern C++

#20

A lot of people state that Python/PHP/Ruby/Javascript on the dynamic language side and Java and other JVM languages on the statically typed side and much quicker to develop than C++, but being a very experienced Java programmer and a decent Javascript programmer I find that I can program just as fast with C++ as long as you use the right choices of libraries and use C++11 or greater. With libraries like Boost, fbfoll…

I think the crux of the development time arguments is that alternatives (eg Django, Rails) are often monolith projects that let you do everything (database modelling, controllers and templating) all in a single convenient, well documented and thoroughly battle-tested library.

You highlight the daunting prospect of moving to C++. You need to pick half a dozen separate libraries and glue them together. Sure, once you've done that a few times it's pretty quick, but it's a scary prospect for a Django dev who can program in C.

Post reply on HN