--- Comment #4 from charles at rebelbase dot com 2006-12-14 17:59 ---
(In reply to comment #2)
> Can you test with -O1 or above?
> As mentioned in comment #1, this should remove all advatages gained from the
> "inlined" version.
It does indeed. Thanks for your
--- Comment #5 from charles at rebelbase dot com 2006-12-14 17:58 ---
(In reply to comment #1)
> -O1 is enough to remove all advantages of this patch.
>
> Also, that isn't really a fair timing comparison, as you've removed the
> function call altogether (I still
vector::operator[](size_type) in bits/stl_vector.h is currently implemented as
reference
operator[](size_type __n)
{ return *(begin() + __n); }
const_reference
operator[](size_type __n) const
{ return *(begin() + __n); }
A faster implementation would be:
vector::size() in bits/stl_vector.h is currently implemented as
size_type
size() const
{ return size_type(end() - begin()); }
A faster implementation is
size_type
size() const
{ return _M_impl._M_finish - _M_impl._M_start; }
Which avoids the temporary iterato