News for hackers. Stuff that matters.
Re:Accidentally quadratic: When Python is faster than C++ by cesarb on Thursday March 04, 2021 @08:22AM (#26341978)
> People often use set instead of unordered_set (and same for map) despite not needing order. This slows things down.

Aren't unordered_set and unordered_map quite new (IIRC, they came only with C++0x)? For most of C++'s history, if you preferred to use the standard library, what you had was only ordered sets and maps.

Re:Accidentally quadratic: When Python is faster than C++ by vlovich123 on Thursday March 04, 2021 @09:53AM (#26343142)
Depends what’s your definition of “quite new”. That’s over 10 years go now :)
Re:Accidentally quadratic: When Python is faster than C++ by asdfasgasdgasdg on Thursday March 04, 2021 @10:21AM (#26343484)
They've been in the language for about a decade now, and before that we had the tr1 hash_map classes that were available in most environments.
Re:Accidentally quadratic: When Python is faster than C++ by mcguire on Thursday March 04, 2021 @04:30PM (#26348649)
C++: the language that's been around for 40 years and is completely new!
Re:Accidentally quadratic: When Python is faster than C++ by einpoklum on Friday March 05, 2021 @11:37AM (#26358801)
Actually, C++ has barely been around at all. It is only with C++20, IIANM, that they key features Bjarne Stroustrup wanted to imbue it with are in place (IIRC; see his "Design & Evolution of C++" book from 1994). Some might even argue that the language C++ _should_ be is not even all here; it's still gradually arriving.
Re:Accidentally quadratic: When Python is faster than C++ by einpoklum on Thursday March 04, 2021 @10:59AM (#26344003)
By now, this is no longer "quite new". A recent C++ community survey suggests that under 10% of developers currently use C++98/C++03 the most. Naturally this is not a valid sample of the whole userbase, but it's a good indication.

Also, in 2005 IIANM, Google published their dense and sparse hash map implementations, which were fast-ish and quite usable.

Re:Accidentally quadratic: When Python is faster than C++ by stonemetal12 on Thursday March 04, 2021 @10:13AM (#26343382)
They were in TR1 in 2005, if I am not mistaken.