mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Bannier <benjamin.bann...@mesosphere.io>
Subject Review Request 58288: Added stringify overload specialized for 'std::string'.
Date Mon, 10 Apr 2017 18:12:25 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58288/
-----------------------------------------------------------

Review request for mesos and Neil Conway.


Repository: mesos


Description
-------

In our code base 'stringify' serves as an explicitly named conversion
function to 'string'. The default implementation invokes a type's
'operator<<' to serialize the object to 'string' via a 'stringstream'
which is not a cheap operation.

This patch adds a trivial overload of 'stringify' for 'string' which
directly returns its argument. This helps us avoid the overhead of the
default overload. Calls of 'stringify' with 'string' argument might
appear in generic code, e.g., currently when invoking 'stringify' on a
container of 'string's.


Diffs
-----

  3rdparty/stout/include/stout/stringify.hpp 698431583d2288d3c635211e651914316bfd3ee9 


Diff: https://reviews.apache.org/r/58288/diff/1/


Testing
-------

`make check` (Fedora 25).

At `-O2` with clang-5 this saves about 90% when stringifying a `string`.


Thanks,

Benjamin Bannier


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message