mesos-reviews mailing list archives

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


> On April 10, 2017, 8:17 p.m., Neil Conway wrote:
> > 3rdparty/stout/include/stout/stringify.hpp
> > Lines 47 (patched)
> > <https://reviews.apache.org/r/58288/diff/1/?file=1686962#file1686962line47>
> >
> >     Can you add an explanatory comment here?

Done, I agree that this looks like a potentially pointless excercise without some context.


- Benjamin


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


On April 10, 2017, 8:22 p.m., Benjamin Bannier wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58288/
> -----------------------------------------------------------
> 
> (Updated April 10, 2017, 8:22 p.m.)
> 
> 
> 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/2/
> 
> 
> 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