News for hackers. Stuff that matters.
Re:Comparing C and C++ usage and performance with a real wor... by 72deluxe on Sunday September 03, 2017 @06:39PM (#15164374)
"The C++ version has no pointers but instead uses value types. This means that all data is stored twice: once in the array and a second time in the hash table."

This is interesting. Are they using modern C++ and making use of moves and perfect forwarding? Or are they just throwing std::strings around and doing millions of copies (e.g. remember std::vector must support copyconstructable, so copy constructors & operator=) in the process? That would explain the allocations in C++ being higher perhaps, particularly if they're using the "wrong" containers. Why not sure unique_ptr or shared_ptr?

It is worth remembering that move constructors and assignment operators only get used in very specific places and you have to ensure that any constructors you write yourself are explicitly noexcept.

There are no comments on this comment yet.