Am 08.02.2015 um 14:28 schrieb Marc Mutz:
> c. Using QMap. As Alex Stepanov put it: every use of a map should be discussed > in a face-to-face meeting with your manager. Since we don't have that, I'd > change this to: Everyone wishing to use a QMap should implement one before > using it for the first time. Then you'd see what you inflict on the world. > > In the vast majority of cases, a sorted vector is much faster, due to > locality-of-reference. A RB-tree is optimized for wildly mixing > insertions, > lookups, and removals. When you can batch updates and separate them from > lookups, time-wise, then a sorted vector is usually preferrable. I totally agree, thank you for raising this. Sadly a sorted vector isn't as convenient to use as a map. Maybe there should some convenience API added, Or does it exist already and I am just too ignorant to know it? > d. Algorithmic complexity. Avoid O(n²) like the plague. Anthing worse than > that should get a big fat comment saying why it's necessary (like: this > optimisation algorithm is equivalent to the knapsack problem, so I need to > use this exponential algorithm, because a) we need the global optimum, not > a local one, and b) the set is always less than four elements. I wonder if one could do a clang plugin checking for the most obvious complexity class sins. Like invocation of methods known to be O(n) from within a lengthy loop. One really has to find a way to educate people about those sins. Ciao, Mathias _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development