public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64128] New: Let vector take advantage of malloc_usable_size for malloc-using allocators
@ 2014-11-30 19:40 gcc-bugzilla at contacts dot eelis.net
  2014-12-01  0:01 ` [Bug libstdc++/64128] " gcc-bugzilla at contacts dot eelis.net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at contacts dot eelis.net @ 2014-11-30 19:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64128

            Bug ID: 64128
           Summary: Let vector take advantage of malloc_usable_size for
                    malloc-using allocators
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugzilla at contacts dot eelis.net

Created attachment 34150
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34150&action=edit
testcase

Changing

  this->_M_impl._M_end_of_storage = __new_start + __len;

to

  this->_M_impl._M_end_of_storage = __new_start +
      malloc_usable_size(__new_start) / sizeof(value_type);

in vector.tcc makes the runtime of the attached program drop from 0.35 seconds
to 0.24 seconds on my machine, a 31% reduction.

This shows there is low hanging fruit for a very common operation
(vector::push_back). A proper implementation would of course only do this for
allocators that are known to be malloc frontends. :)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-01 17:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-30 19:40 [Bug libstdc++/64128] New: Let vector take advantage of malloc_usable_size for malloc-using allocators gcc-bugzilla at contacts dot eelis.net
2014-12-01  0:01 ` [Bug libstdc++/64128] " gcc-bugzilla at contacts dot eelis.net
2014-12-01 11:14 ` redi at gcc dot gnu.org
2014-12-01 17:14 ` gcc-bugzilla at contacts dot eelis.net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).