Programmer Performance Using STLs and Custom Classes

I work in an environment where, for historical reasons, we use a hash of custom utility classes, most of which were written before the STL appeared on the scene. There are many reasons why I think it’s a good idea to at least write new code using STL, but most importantly, I think that it increases the programmer’s productivity. Unfortunately, this is a point that I do not know how to prove.

Are there any studies that are trying to quantify or even just hint at a performance improvement when using STL?

Update: I think I should have been more specific. I do not recommend rewriting existing code, and I am not worried about new employers who will start working. The former would be stupid, and the latter alone is not enough to convince people.

+1
source share
12 answers

There are no studies that show that STL is more productive just because it is STL. The performance from its use is due to the fact that it is familiar with ordinary programmers and because the code has already been written and tested.

If your company already has service classes that employees are familiar with, and this utility code is used on the entire existing code base, then switching to STL can be detrimental to performance.

, STL . , . , STL, , , , , .

STL , ++ . ++, STL, .

+6

, STL "", - , , . , .

STL , , , . , , , . .

STL , . , , . STL - STL . .

: "" , .

, - , STL, , ++- , , ( , ).

+3

, .

, , , , , , , STL .

, , , STL , , , STL.

+2

STL, , - - Boost, Arabica, SOCI .. STL, .

+2

. , . , , . STL , , .

, STL , , !

+2

, , - .

+1

, STL , .., STL, , STL.

2 :

struct DoSomething {
  bool operator ()(Container::value_type const & v) const
  {
    // ...
  }
};

void bar (Container const & c)
{
  std::for_each (c.begin (), c.end (), DoSomething ());
}

, DoSomething:: operator() , . , "DoSomething:: operator()".

. - ", ", , . for .

+1

, , :

STL ( , ) , .

, STL, , // .

. , (. "" ), , .

, , .

" , ", - , , , (- , pre - ..

, , (.. , ..) , STL, " ", .

, ( ), , STL .

+1

, STL. , STL . IMO, .

, STL , -. ( <algorithmms> , , , .) , STL ( Boost, ), . .

.

0

, ++. , STL ? , , STL.

0

, , . STL, , .

0

, , . , STL .

This is a problem of service and readability. (1) Using STL helps developers understand the code at a glance, rather than needing to know their way around user implementations. (2) STL is well documented and well understood - what about your custom classes? (3) STL is well tested. (4) STL has asymptotic upper and lower run-time bounds.

Good luck.

0
source

All Articles